summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-01-20 18:24:02 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2017-01-20 18:24:54 -0800
commitb14be5085cd1aefd473a000456b21270e6070711 (patch)
treee15813f9be5eb1de322aac2ccae736ce3d029d22 /tests/misc
parent7cecdd6d69ea6981f93c2f15918c10f2e7af14cd (diff)
downloadcoreutils-b14be5085cd1aefd473a000456b21270e6070711.tar.xz
date: fix TZ= regression
Problem reported by Paul Wise for Debian, in: https://bugs.debian.org/851934 This is fallout from the fix for GNU Bug#23035. * src/date.c (batch_convert): New args TZ and TZSTRING. All uses changed. (batch_convert, main): Adjust to parse_datetime2 API change. (main): Allocate time zone object. * tests/misc/date-debug.sh: Fix incorrect test case, caught by the fix. * tests/misc/date.pl: Test the fix.
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/date-debug.sh4
-rwxr-xr-xtests/misc/date.pl6
2 files changed, 8 insertions, 2 deletions
diff --git a/tests/misc/date-debug.sh b/tests/misc/date-debug.sh
index 06de8dd37..48f460506 100755
--- a/tests/misc/date-debug.sh
+++ b/tests/misc/date-debug.sh
@@ -48,10 +48,10 @@ date: new date/time = '(Y-M-D) 1990-12-14 00:00:00 TZ=+09:00'
date: '(Y-M-D) 1990-12-14 00:00:00 TZ=+09:00' = 661100400 epoch-seconds
date: after time adjustment (+0 hours, -90 minutes, +0 seconds, +0 ns),
date: new time = 661095000 epoch-seconds
-date: output timezone: -06:00 (set from TZ="America/Belize" environment value)
+date: output timezone: +09:00 (set from TZ="Asia/Tokyo" environment value)
date: final: 661095000.000000000 (epoch-seconds)
date: final: (Y-M-D) 1990-12-13 13:30:00 (UTC0)
-date: final: (Y-M-D) 1990-12-13 07:30:00 (output timezone TZ=-06:00)
+date: final: (Y-M-D) 1990-12-13 22:30:00 (output timezone TZ=+09:00)
Thu Dec 13 07:30:00 CST 1990
EOF
diff --git a/tests/misc/date.pl b/tests/misc/date.pl
index 519c2474d..f026909bf 100755
--- a/tests/misc/date.pl
+++ b/tests/misc/date.pl
@@ -291,6 +291,12 @@ my @Tests =
{ERR => "date: invalid date 'TZ=\"\"\"'\n"},
{EXIT => 1},
],
+
+ # https://bugs.debian.org/851934#10
+ ['cross-TZ-mishandled', "-d 'TZ=\"EST5\" 1970-01-01 00:00'",
+ {ENV => 'TZ=PST8'},
+ {OUT => 'Wed Dec 31 21:00:00 PST 1969'},
+ ],
);
# Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364.