diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2017-05-14 01:29:05 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-05-14 01:29:29 -0700 |
| commit | 4132bd74e9816ca913f862835cc062e092ab8b79 (patch) | |
| tree | 7861e23ef6007320ca0417a147656cf9774473b7 /lib/mktime.c | |
| parent | 9a5e864de731e113badbe300b1e4174f103547fa (diff) | |
| download | emacs-4132bd74e9816ca913f862835cc062e092ab8b79.tar.gz | |
Merge from gnulib
This incorporates:
2017-05-13 largefile: Simplify
2017-05-13 largefile: Improve and document
2017-05-13 truncate: New module
2017-05-13 windows-stat-timespec: New module
2017-05-13 windows-stat-override: New module
2017-05-11 getopt-posix: port to mingw
2017-05-11 gettimeofday: Increase precision on mingw
2017-05-10 time: Fix missing initialization of HAVE_TIMEZONE_T
2017-05-10 Implement a way to opt out from MSVC support
2017-05-09 tzset: Expand comment about TZ problem on native Windows
* build-aux/config.guess, lib/dup2.c, lib/fcntl.c, lib/fsync.c:
* lib/getdtablesize.c, lib/getopt.c, lib/gettimeofday.c:
* lib/mktime.c, lib/stat-time.h, lib/sys_stat.in.h, lib/unistd.in.h:
* lib/utimens.c, m4/gettimeofday.m4, m4/largefile.m4:
* m4/sys_stat_h.m4, m4/sys_time_h.m4, m4/time_h.m4, m4/time_rz.m4:
* m4/unistd_h.m4: Copy from gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Diffstat (limited to 'lib/mktime.c')
| -rw-r--r-- | lib/mktime.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/mktime.c b/lib/mktime.c index 06d5916e910..058ab65c03e 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -491,9 +491,28 @@ time_t mktime (struct tm *tp) { # if NEED_MKTIME_WINDOWS - /* If the environment variable TZ has been set by Cygwin, neutralize it. - The Microsoft CRT interprets TZ differently than Cygwin and produces - incorrect results if TZ has the syntax used by Cygwin. */ + /* Rectify the value of the environment variable TZ. + There are four possible kinds of such values: + - Traditional US time zone names, e.g. "PST8PDT". Syntax: see + <https://msdn.microsoft.com/en-us/library/90s5c885.aspx> + - Time zone names based on geography, that contain one or more + slashes, e.g. "Europe/Moscow". + - Time zone names based on geography, without slashes, e.g. + "Singapore". + - Time zone names that contain explicit DST rules. Syntax: see + <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03> + The Microsoft CRT understands only the first kind. It produces incorrect + results if the value of TZ is of the other kinds. + But in a Cygwin environment, /etc/profile.d/tzset.sh sets TZ to a value + of the second kind for most geographies, or of the first kind in a few + other geographies. If it is of the second kind, neutralize it. For the + Microsoft CRT, an absent or empty TZ means the time zone that the user + has set in the Windows Control Panel. + If the value of TZ is of the third or fourth kind -- Cygwin programs + understand these syntaxes as well --, it does not matter whether we + neutralize it or not, since these values occur only when a Cygwin user + has set TZ explicitly; this case is 1. rare and 2. under the user's + responsibility. */ const char *tz = getenv ("TZ"); if (tz != NULL && strchr (tz, '/') != NULL) _putenv ("TZ="); |
