diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index dcb1d8d6b88..4f6108102db 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2085,7 +2085,11 @@ format_time_string (char const *format, ptrdiff_t formatlen, | |||
| 2085 | USE_SAFE_ALLOCA; | 2085 | USE_SAFE_ALLOCA; |
| 2086 | 2086 | ||
| 2087 | timezone_t tz = tzlookup (zone, false); | 2087 | timezone_t tz = tzlookup (zone, false); |
| 2088 | tmp = emacs_localtime_rz (tz, &t.tv_sec, tmp); | 2088 | /* On some systems, like 32-bit MinGW, tv_sec of struct timespec is |
| 2089 | a 64-bit type, but time_t is a 32-bit type. emacs_localtime_rz | ||
| 2090 | expects a pointer to time_t value. */ | ||
| 2091 | time_t tsec = t.tv_sec; | ||
| 2092 | tmp = emacs_localtime_rz (tz, &tsec, tmp); | ||
| 2089 | if (! tmp) | 2093 | if (! tmp) |
| 2090 | { | 2094 | { |
| 2091 | xtzfree (tz); | 2095 | xtzfree (tz); |
| @@ -2353,7 +2357,10 @@ the data it can't find. */) | |||
| 2353 | zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, | 2357 | zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, |
| 2354 | zone, &local_tm); | 2358 | zone, &local_tm); |
| 2355 | 2359 | ||
| 2356 | if (HAVE_TM_GMTOFF || gmtime_r (&value.tv_sec, &gmt_tm)) | 2360 | /* gmtime_r expects a pointer to time_t, but tv_sec of struct |
| 2361 | timespec on some systems (MinGW) is a 64-bit field. */ | ||
| 2362 | time_t tsec = value.tv_sec; | ||
| 2363 | if (HAVE_TM_GMTOFF || gmtime_r (&tsec, &gmt_tm)) | ||
| 2357 | { | 2364 | { |
| 2358 | long int offset = (HAVE_TM_GMTOFF | 2365 | long int offset = (HAVE_TM_GMTOFF |
| 2359 | ? tm_gmtoff (&local_tm) | 2366 | ? tm_gmtoff (&local_tm) |