From a71f1f98d4f0a2bc9cb47f820c6b03724629aee5 Mon Sep 17 00:00:00 2001 From: Timur Bakeyev Date: Tue, 28 Sep 1999 01:16:19 +0000 Subject: Use tm.gmtoff or timezone to get correct offset from UTC, according to 1999-09-27 Timur Bakeyev * timeutil.c (time_from_isodate): Use tm.gmtoff or timezone to get correct offset from UTC, according to HAVE_TM_GMTOFF or HAVE_TIMEZONE. See also 1999-07-19 Matt Martin svn path=/trunk/; revision=1316 --- calendar/timeutil.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'calendar/timeutil.c') diff --git a/calendar/timeutil.c b/calendar/timeutil.c index 78c1c46d56..7ddc0e04d4 100644 --- a/calendar/timeutil.c +++ b/calendar/timeutil.c @@ -34,7 +34,12 @@ time_from_isodate (char *str) t = mktime (&my_tm); if (str [15] == 'Z') - t -= timezone; +#if defined(HAVE_TM_GMTOFF) + t -= my_tm.tm_gmtoff +#elsif defined(HAVE_TIMEZONE) + t -= timezone +#endif + ; return t; } @@ -86,11 +91,11 @@ format_simple_hour (int hour, int use_am_pm) */ if (use_am_pm) - sprintf (buf, "%d%s", + g_snprintf (buf, sizeof(buf), "%d%s", (hour == 0) ? 12 : (hour > 12) ? (hour - 12) : hour, (hour < 12) ? _("am") : _("pm")); else - sprintf (buf, "%02d%s", hour, _("h")); + g_snprintf (buf, sizeof(buf), "%02d%s", hour, _("h")); return buf; -- cgit v1.2.3