summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-29 12:59:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-29 12:59:58 -0700
commitdfee517e54d27412e28481637ba7d763ec34face (patch)
tree9e7aa4734d503a45247d2e6db321cd09a6bc2c62
parenta0fe82344b2f8435676c1fb2d155ff0d13a0ef50 (diff)
downloadtxr-dfee517e54d27412e28481637ba7d763ec34face.tar.gz
txr-dfee517e54d27412e28481637ba7d763ec34face.tar.bz2
txr-dfee517e54d27412e28481637ba7d763ec34face.zip
* lib.c (string_time): If possible, change the timezone in the
struct tm from "GMT" to "UTC", so that the time_string_utc function will use UTC for the %Z format.
-rw-r--r--ChangeLog6
-rw-r--r--lib.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 47dc8873..3bbbceae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-29 Kaz Kylheku <kaz@kylheku.com>
+
+ * lib.c (string_time): If possible, change the timezone in the
+ struct tm from "GMT" to "UTC", so that the time_string_utc
+ function will use UTC for the %Z format.
+
2014-03-27 Kaz Kylheku <kaz@kylheku.com>
Fix a bug arising from putting generation 1 objects into the
diff --git a/lib.c b/lib.c
index afcf1689..03760ef0 100644
--- a/lib.c
+++ b/lib.c
@@ -5666,6 +5666,11 @@ static val string_time(struct tm *(*break_time_fn)(const time_t *, struct tm *),
if (break_time_fn(&time, &broken_out_time) == 0)
return nil;
+#if HAVE_TM_ZONE
+ if (strcmp(broken_out_time.TM_ZONE, "GMT") == 0)
+ broken_out_time.TM_ZONE = "UTC";
+#endif
+
if (strftime(buffer, sizeof buffer, format, &broken_out_time) == 0)
buffer[0] = 0;