about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-01 08:50:44 -0700
committerbors <bors@rust-lang.org>2013-09-01 08:50:44 -0700
commitc70486fffe4d1eb682233749779cf0053cf83b01 (patch)
tree68e06ee57e6b939a97651fae750b9a41c8211ccc /src/rt/rust_builtin.cpp
parent7c5398b61255b557185443e9f51c4bea6a188a75 (diff)
parent30fc2c8df2fc565b20d8df3a202cb0c7d089afd0 (diff)
downloadrust-c70486fffe4d1eb682233749779cf0053cf83b01.tar.gz
rust-c70486fffe4d1eb682233749779cf0053cf83b01.zip
auto merge of #8913 : poiru/rust/issue-8702, r=cmr
Closes #8702.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 27cc486c39e..03a17d2c2ef 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -321,13 +321,16 @@ rust_localtime(int64_t sec, int32_t nsec, rust_tm *timeptr) {
     time_t s = sec;
     LOCALTIME(&s, &tm);
 
+    const char* zone = NULL;
 #if defined(__WIN32__)
     int32_t gmtoff = -timezone;
-    char zone[64];
-    strftime(zone, sizeof(zone), "%Z", &tm);
+    char buffer[64];
+    if (strftime(buffer, sizeof(buffer), "%Z", &tm) > 0) {
+        zone = buffer;
+    }
 #else
     int32_t gmtoff = tm.tm_gmtoff;
-    const char *zone = tm.tm_zone;
+    zone = tm.tm_zone;
 #endif
 
     tm_to_rust_tm(&tm, timeptr, gmtoff, zone, nsec);