#include "ioloop.h"
#include "str.h"
#include "utc-mktime.h"
+#include "utc-offset.h"
#include "mbox-from.h"
#include <time.h>
} else {
/* assume local timezone */
*time_r = mktime(&tm);
- *tz_offset_r = -timezone/60;
+ *tz_offset_r = utc_offset(localtime(time_r), *time_r);
}
*sender_r = i_strdup_until(msg_start, sender_end);
/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
+#include "utc-offset.h"
#include "mbox-from.h"
#include "test-common.h"
static void test_mbox_from_create(void)
{
+ time_t t = 1234567890;
+ int tz;
+
test_begin("mbox_from_create()");
- test_assert(strcmp(mbox_from_create("user", 1234567890+timezone),
+ tz = utc_offset(localtime(&t), t) * -60;
+ test_assert(strcmp(mbox_from_create("user", t+tz),
"From user Fri Feb 13 23:31:30 2009\n") == 0);
test_end();
}