This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=76cc330864a9680365123c86f8d5a394f952dcc5 The branch, master has been updated via 76cc330864a9680365123c86f8d5a394f952dcc5 (commit) via 912224f8b9fd7638fd48b86670fffca693c2bf9f (commit) from 7efa4777bddb68299355dce1f4125533d6467023 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 76cc330864a9680365123c86f8d5a394f952dcc5 Author: Sergey Poznyakoff <g...@gnu.org.ua> Date: Thu Dec 8 19:49:49 2011 +0200 New function mu_datetime_tz_local. The function initializes mu_timezone structure to the local timezone. * include/mailutils/datetime.h (mu_utc_offset): Change return type. (mu_datetime_tz_local): New proto. * libmailutils/datetime/tzlocal.c: New file. * libmailutils/datetime/Makefile.am: Add new file. * libmailutils/datetime/scantime.c (mu_scan_datetime): Use mu_datetime_tz_local to initialize local TZ. * mh/mh_format.c (_parse_date): Likewise. * libmailutils/datetime/utcoff.c (mu_utc_offset): Returns int. * libmu_sieve/actions.c (mime_create_ds): Use mu_c_streamftime to format time directly to stream. commit 912224f8b9fd7638fd48b86670fffca693c2bf9f Author: Sergey Poznyakoff <g...@gnu.org.ua> Date: Thu Dec 8 19:23:03 2011 +0200 Rename mu_tm2time to mu_datetime_to_utc. ----------------------------------------------------------------------- Summary of changes: imap4d/util.c | 6 ++-- include/mailutils/datetime.h | 5 ++- libmailutils/datetime/Makefile.am | 1 + libmailutils/datetime/scantime.c | 5 +--- libmailutils/datetime/streamftime.c | 2 +- mail/save.c => libmailutils/datetime/tzlocal.c | 21 ++++++++----------- libmailutils/datetime/unixtime.c | 5 +-- libmailutils/datetime/utcoff.c | 2 +- libmu_sieve/actions.c | 25 ++++++++++++----------- libproto/imap/mbox.c | 2 +- mh/mh_format.c | 6 ++-- mh/sortm.c | 2 +- 12 files changed, 39 insertions(+), 43 deletions(-) copy mail/save.c => libmailutils/datetime/tzlocal.c (74%) diff --git a/imap4d/util.c b/imap4d/util.c index 2482b9b..4165f42 100644 --- a/imap4d/util.c +++ b/imap4d/util.c @@ -379,7 +379,7 @@ util_parse_internal_date (char *date, time_t *timep, adjust_tm (&tm, &tz, flag); - time = mu_tm2time (&tm, &tz); + time = mu_datetime_to_utc (&tm, &tz); if (time == (time_t) - 1) return 2; @@ -398,7 +398,7 @@ util_parse_822_date (const char *date, time_t *timep, if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0) { adjust_tm (&tm, &tz, flag); - *timep = mu_tm2time (&tm, &tz); + *timep = mu_datetime_to_utc (&tm, &tz); return 0; } return 1; @@ -414,7 +414,7 @@ util_parse_ctime_date (const char *date, time_t *timep, if (mu_scan_datetime (date, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) { adjust_tm (&tm, &tz, flag); - *timep = mu_tm2time (&tm, &tz); + *timep = mu_datetime_to_utc (&tm, &tz); return 0; } return 1; diff --git a/include/mailutils/datetime.h b/include/mailutils/datetime.h index de00618..bc1aa98 100644 --- a/include/mailutils/datetime.h +++ b/include/mailutils/datetime.h @@ -58,8 +58,9 @@ struct mu_timezone int mu_parse_date (const char *p, time_t *rettime, const time_t *now); -time_t mu_utc_offset (void); -time_t mu_tm2time (struct tm *timeptr, struct mu_timezone *tz); +int mu_utc_offset (void); +void mu_datetime_tz_local (struct mu_timezone *tz); +time_t mu_datetime_to_utc (struct tm *timeptr, struct mu_timezone *tz); size_t mu_strftime (char *s, size_t max, const char *format, struct tm *tm); int mu_c_streamftime (mu_stream_t str, const char *fmt, struct tm *tm, diff --git a/libmailutils/datetime/Makefile.am b/libmailutils/datetime/Makefile.am index f9a4f45..943b32b 100644 --- a/libmailutils/datetime/Makefile.am +++ b/libmailutils/datetime/Makefile.am @@ -25,6 +25,7 @@ libdatetime_la_SOURCES = \ streamftime.c\ strftime.c\ tab.c\ + tzlocal.c\ unixtime.c\ utcoff.c\ yd.c diff --git a/libmailutils/datetime/scantime.c b/libmailutils/datetime/scantime.c index 670052b..7a4803f 100644 --- a/libmailutils/datetime/scantime.c +++ b/libmailutils/datetime/scantime.c @@ -325,10 +325,7 @@ mu_scan_datetime (const char *input, const char *fmt, #endif /* provide default timezone, in case it is not supplied in input */ if (tz) - { - memset (tz, 0, sizeof *tz); - tz->utc_offset = mu_utc_offset (); - } + mu_datetime_tz_local (tz); /* Skip leading whitespace */ input = mu_str_skip_class (input, MU_CTYPE_BLANK); diff --git a/libmailutils/datetime/streamftime.c b/libmailutils/datetime/streamftime.c index e67d7d4..311fe00 100644 --- a/libmailutils/datetime/streamftime.c +++ b/libmailutils/datetime/streamftime.c @@ -298,7 +298,7 @@ mu_c_streamftime (mu_stream_t str, const char *fmt, struct tm *input_tm, case 's': /* The number of seconds since the Epoch */ rc = mu_stream_printf (str, "%lu", - (unsigned long) mu_tm2time (&tm, tz)); + (unsigned long) mu_datetime_to_utc (&tm, tz)); break; case 'S': diff --git a/mail/save.c b/libmailutils/datetime/tzlocal.c similarity index 74% copy from mail/save.c copy to libmailutils/datetime/tzlocal.c index 50dd061..cc561f5 100644 --- a/mail/save.c +++ b/libmailutils/datetime/tzlocal.c @@ -1,6 +1,5 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999, 2001, 2007, 2010, 2011 Free Software Foundation, - Inc. + Copyright (C) 2011 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,16 +14,14 @@ You should have received a copy of the GNU General Public License along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */ -#include "mail.h" +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include <mailutils/datetime.h> -/* - * s[ave] [file] - * s[ave] [msglist] file - * S[ave] [msglist] - */ - -int -mail_save (int argc, char **argv) +void +mu_datetime_tz_local (struct mu_timezone *tz) { - return mail_copy0 (argc, argv, 1); + tz->utc_offset = mu_utc_offset (); + tz->tz_name = NULL; } diff --git a/libmailutils/datetime/unixtime.c b/libmailutils/datetime/unixtime.c index a893117..38c1590 100644 --- a/libmailutils/datetime/unixtime.c +++ b/libmailutils/datetime/unixtime.c @@ -25,10 +25,9 @@ #define JD_OF_EPOCH 2440588 -/* Convert struct tm into time_t, taking into account timezone offset. */ -/* FIXME: Ignores DST */ +/* Convert struct tm into UTC. */ time_t -mu_tm2time (struct tm *tm, struct mu_timezone *tz) +mu_datetime_to_utc (struct tm *tm, struct mu_timezone *tz) { int jd = mu_datetime_julianday (tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday); diff --git a/libmailutils/datetime/utcoff.c b/libmailutils/datetime/utcoff.c index cfa3b89..56264a7 100644 --- a/libmailutils/datetime/utcoff.c +++ b/libmailutils/datetime/utcoff.c @@ -22,7 +22,7 @@ /* Convert time 0 at UTC to our localtime, that tells us the offset of our current timezone from UTC. */ -time_t +int mu_utc_offset (void) { time_t t = 0; diff --git a/libmu_sieve/actions.c b/libmu_sieve/actions.c index 5f2ff51..ebc3015 100644 --- a/libmu_sieve/actions.c +++ b/libmu_sieve/actions.c @@ -185,12 +185,11 @@ mime_create_ds (mu_mime_t mime, mu_message_t orig) mu_header_t hdr; mu_body_t body; char *email; - char datestr[80]; - time_t t = time (NULL); struct tm tm, *tmp; struct mu_timezone tz; mu_envelope_t env; const char *p; + time_t t = time (NULL); mu_message_create (&newmsg, NULL); mu_message_get_header (newmsg, &hdr); @@ -202,15 +201,17 @@ mime_create_ds (mu_mime_t mime, mu_message_t orig) mu_message_get_envelope (orig, &env); if (mu_envelope_sget_date (env, &p) == 0 && mu_scan_datetime (p, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) - t = mu_tm2time (&tm, &tz); + { + tmp = &tm; + } else - /* Use local time instead */ - t = time (NULL); - tmp = localtime (&t); + { + tmp = localtime (&t); + mu_datetime_tz_local (&tz); + } - /* FIXME: timezone info is lost */ - mu_strftime (datestr, sizeof datestr, "%a, %b %d %H:%M:%S %Y %Z", tmp); - mu_stream_printf (stream, "Arrival-Date: %s\n", datestr); + mu_c_streamftime (stream, "Arrival-Date: %a, %b %d %H:%M:%S %Y %Z%n", + tmp, &tz); email = mu_get_user_email (NULL); mu_stream_printf (stream, "Final-Recipient: RFC822; %s\n", @@ -220,10 +221,10 @@ mime_create_ds (mu_mime_t mime, mu_message_t orig) mu_stream_printf (stream, "Disposition: automatic-action/MDN-sent-automatically;deleted\n"); - t = time (NULL); tmp = localtime (&t); - mu_strftime (datestr, sizeof datestr, "%a, %b %d %H:%M:%S %Y %Z", tmp); - mu_stream_printf (stream, "Last-Attempt-Date: %s\n", datestr); + mu_datetime_tz_local (&tz); + mu_c_streamftime (stream, "Last-Attempt-Date: %a, %b %d %H:%M:%S %Y %Z%n", + tmp, &tz); mu_stream_close (stream); mu_stream_destroy (&stream); diff --git a/libproto/imap/mbox.c b/libproto/imap/mbox.c index 5a5f69f..c8a0dea 100644 --- a/libproto/imap/mbox.c +++ b/libproto/imap/mbox.c @@ -1530,7 +1530,7 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen, if (mu_parse_imap_date_time(datep, &tm, &tz) != 0) now = (time_t)-1; else - now = mu_tm2time (&tm, &tz); + now = mu_datetime_to_utc (&tm, &tz); /* if the time was unparseable, or mktime() didn't like what we parsed, use the calendar time. */ diff --git a/mh/mh_format.c b/mh/mh_format.c index 9633cdb..78bc3ed 100644 --- a/mh/mh_format.c +++ b/mh/mh_format.c @@ -1172,7 +1172,7 @@ _parse_date (struct mh_machine *mach, struct tm *tm, struct mu_timezone *tz) /*mu_error ("can't parse date: [%s]", date);*/ time (&t); *tm = *localtime (&t); - tz->utc_offset = mu_utc_offset (); + mu_datetime_tz_local (tz); } return 0; @@ -1458,7 +1458,7 @@ builtin_clock (struct mh_machine *mach) if (_parse_date (mach, &tm, &tz)) return; - mach->arg_num = mu_tm2time (&tm, &tz); + mach->arg_num = mu_datetime_to_utc (&tm, &tz); } /* rclock date integer seconds prior to current time*/ @@ -1471,7 +1471,7 @@ builtin_rclock (struct mh_machine *mach) if (_parse_date (mach, &tm, &tz)) return; - mach->arg_num = now - mu_tm2time (&tm, &tz); + mach->arg_num = now - mu_datetime_to_utc (&tm, &tz); } struct diff --git a/mh/sortm.c b/mh/sortm.c index 4e6d052..5778793 100644 --- a/mh/sortm.c +++ b/mh/sortm.c @@ -341,7 +341,7 @@ _parse_822_date (char *date, time_t * timep) if (mu_parse822_date_time (&p, date + strlen (date), &tm, &tz) == 0) { - *timep = mu_tm2time (&tm, &tz); + *timep = mu_datetime_to_utc (&tm, &tz); return 0; } return 1; hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org https://lists.gnu.org/mailman/listinfo/commit-mailutils