On 5/7/23 07:52, Andreas Schwab wrote:
Thus TZ=UTC+2 means two hours before UTC.


Yes, and this mistake seems to be common enough that I installed the attached patch into Gnulib, so that it'll propagate into the Coreutils manual, which should help people who read the 'date' documentation (admittedly only a subset of 'date' users).
From 9f205ff9624b8e10b4331432c59bc732b8c1a7fe Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Sun, 7 May 2023 09:28:57 -0700
Subject: [PATCH] Warn against bogus TZ settings

* doc/parse-datetime.texi (Specifying time zone rules):
Warn against TZ="UTC=5".
---
 ChangeLog               | 6 ++++++
 doc/parse-datetime.texi | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 06ff163e0e..823d32b66f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-05-07  Paul Eggert  <egg...@cs.ucla.edu>
+
+	Warn against bogus TZ settings
+	* doc/parse-datetime.texi (Specifying time zone rules):
+	Warn against TZ="UTC=5".
+
 2023-05-05  Bruno Haible  <br...@clisp.org>
 
 	dirfd: Add tests.
diff --git a/doc/parse-datetime.texi b/doc/parse-datetime.texi
index d54d7660c8..ec0160da8e 100644
--- a/doc/parse-datetime.texi
+++ b/doc/parse-datetime.texi
@@ -574,6 +574,9 @@ This example uses the somewhat-confusing POSIX convention for rules.
 and the time zone is 7 hours west of Greenwich, and
 @samp{TZ="<+0530>-5:30"} says that the time zone abbreviation is @samp{+0530}
 and the time zone is 5 hours 30 minutes east of Greenwich.
+(One should never use a setting like @samp{TZ="UTC-5"}, since
+this would incorrectly imply that local time is five hours east of
+Greenwich and the time zone is called ``UTC''.)
 Although trickier POSIX @env{TZ} settings like
 @samp{TZ="<-05>+5<-04>,M3.2.0/2,M11.1.0/2"} can specify some daylight
 saving regimes, location-based settings like
-- 
2.40.1

Reply via email to