diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-06-16 11:09:21 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-06-16 11:09:21 +0000 |
commit | 92bd70fb85bce57ac47ba5d8af008736832c955a (patch) | |
tree | 3fec830fb36ef1af2aaeb411f23dc76c3fcd7c15 /timezone/tzselect.ksh | |
parent | a448ee41e70a0b1d26557ffce8e550fe4aad2525 (diff) | |
download | glibc-92bd70fb85bce57ac47ba5d8af008736832c955a.tar.gz glibc-92bd70fb85bce57ac47ba5d8af008736832c955a.tar.xz glibc-92bd70fb85bce57ac47ba5d8af008736832c955a.zip |
Update timezone code from tzcode 2017b.
This patch updates files coming from tzcode to the versions in tzcode 2017b. A couple of changes to other glibc code are needed. time/tzset.c was using the SECSPERDAY macro from tzfile.h, which no longer defines that macro, so a local definition is added to tzset.c. Because timezone/private.h now defines the _ macro whenever HAVE_GETTEXT is true, even if it was previously defined, it is also necessary to avoid a conflict with the definition in include/libintl.h. Defining _ISOMAC is the obvious way to avoid such internal definitions being visible, together with defining TZ_DOMAIN so that zic and zdump continue to get the messages from the libc domain as desired. However, zic and zdump rely on PKGVERSION and REPORT_BUGS_TO from config.h, which is not included by default with _ISOMAC, so -include config.h needs adding to the options for these programs as well. Together those changes allow unmodified tzcode 2017b sources to work in glibc. Tested for x86_64. * timezone/private.h: Update from tzcode 2017b. * timezone/tzfile.h: Likewise. * timezone/tzselect.ksh: Likewise. * timezone/zdump.c: Likewise. * timezone/zic.c: Likewise. * timezone/Makefile (tz-cflags): Add -D_ISOMAC -DTZ_DOMAIN='"libc"' -include $(common-objpfx)config.h. * time/tzset.c (SECSPERDAY): New macro.
Diffstat (limited to 'timezone/tzselect.ksh')
-rwxr-xr-x | timezone/tzselect.ksh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh index 2c3b2f4438..d2c3a6d1dd 100755 --- a/timezone/tzselect.ksh +++ b/timezone/tzselect.ksh @@ -7,7 +7,7 @@ REPORT_BUGS_TO=tz@iana.org # Ask the user about the time zone, and output the resulting TZ value to stdout. # Interact with the user via stderr and stdin. -# Contributed by Paul Eggert. +# Contributed by Paul Eggert. This file is in the public domain. # Porting notes: # @@ -346,11 +346,14 @@ while 'that is 10 hours ahead (east) of UTC.' read TZ $AWK -v TZ="$TZ" 'BEGIN { - tzname = "[^-+,0-9][^-+,0-9][^-+,0-9]+" - time = "[0-2]?[0-9](:[0-5][0-9](:[0-5][0-9])?)?" + tzname = "(<[[:alnum:]+-]{3,}>|[[:alpha:]]{3,})" + time = "(2[0-4]|[0-1]?[0-9])" \ + "(:[0-5][0-9](:[0-5][0-9])?)?" offset = "[-+]?" time - date = "(J?[0-9]+|M[0-9]+\\.[0-9]+\\.[0-9]+)" - datetime = "," date "(/" time ")?" + mdate = "M([1-9]|1[0-2])\\.[1-5]\\.[0-6]" + jdate = "((J[1-9]|[0-9]|J?[1-9][0-9]" \ + "|J?[1-2][0-9][0-9])|J?3[0-5][0-9]|J?36[0-5])" + datetime = ",(" mdate "|" jdate ")(/" time ")?" tzpattern = "^(:.*|" tzname offset "(" tzname \ "(" offset ")?(" datetime datetime ")?)?)$" if (TZ ~ tzpattern) exit 1 @@ -509,7 +512,7 @@ while case $TZsec in $UTsec) extra_info=" -Local time is now: $TZdate. +Selected time is now: $TZdate. Universal Time is now: $UTdate." break esac @@ -545,7 +548,7 @@ case $SHELL in *) file=.profile line="TZ='$TZ'; export TZ" esac -say >&2 " +test -t 1 && say >&2 " You can make this change permanent for yourself by appending the line $line to the file '$file' in your home directory; then log out and log in again. |