From 725c8d6bed902a181da867a5d38efd01f62d8c9a Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Fri, 9 Aug 2019 20:16:06 -0600 Subject: [PATCH] date: mention military timezone changes from gnulib Gnulib commits f1f10d47be8762e4ca17c8957a0520b08d28abfb and 0673d8ab42c9bb0cf618a21b537cdd8fb976fb73 negated the meaning of military timezones parsed in gnu date. See https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html and https://lists.gnu.org/r/coreutils/2019-08/msg00021.html * NEWS: Mention this user-visible change. * tests/misc/date.pl: Add tests for the new behavior. --- NEWS | 13 +++++++++++++ tests/misc/date.pl | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/NEWS b/NEWS index 97c9d18bdf..6719e504da 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,19 @@ GNU coreutils NEWS -*- outline -*- coherency of file system attributes, useful on network file systems. +** Changes in behavior + + date now parses military time zones in accordance with common usage: + "A" to "M" are equivalent to UTC+1 to UTC+12 + "N" to "Y" are equivalent to UTC-1 to UTC-12 + "Z" is "zulu" time (UTC). + For example, 'date -d "09:00B" is now equivalent to 9am in UTC+2 time zone. + Previously, military time zones were parsed according to the obsolete + rfc822, with their value negated (e.g., "B" was equivalent to UTC-2). + [The old behavior was introduced in sh-utils 2.0.15 ca. 1999, predating + coreutils package.] + + * Noteworthy changes in release 8.31 (2019-03-10) [stable] ** Bug fixes diff --git a/tests/misc/date.pl b/tests/misc/date.pl index 9ba3d39839..92755b1f2a 100755 --- a/tests/misc/date.pl +++ b/tests/misc/date.pl @@ -300,6 +300,16 @@ my @Tests = # https://bugs.gnu.org/34608 ['date-century-plus', '-d @0 +.%+4C.', {OUT => '.+019.'}], + + + # Military time zones, new behavior (since 8.32) + # https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html + ['mtz1', '-u -d "09:00B" +%T', {OUT => '07:00:00'}], + ['mtz2', '-u -d "09:00L" +%T', {OUT => '22:00:00'}], + ['mtz3', '-u -d "09:00N" +%T', {OUT => '10:00:00'}], + ['mtz4', '-u -d "09:00T" +%T', {OUT => '16:00:00'}], + ['mtz5', '-u -d "09:00X" +%T', {OUT => '20:00:00'}], + ['mtz6', '-u -d "09:00Z" +%T', {OUT => '09:00:00'}], ); # Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364. -- 2.47.2