<div dir="ltr">I think that might give cause for confusion with respect to RFC3339 style string formatting, section 4.3:<div><br></div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">4.3. Unknown Local Offset Convention </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">If the time in UTC is known, but the offset to local time is unknown,<br> this can be represented with an offset of "-00:00". This differs<br> semantically from an offset of "Z" or "+00:00", which imply that UTC<br> is the preferred reference point for the specified time.</blockquote><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><font face="arial, helvetica, sans-serif">That's not what we intend to convey in this case, is it?</font></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><font face="arial, helvetica, sans-serif">I realize that the we're not trying to output RFC3339, but I think it could lead to confusion.</font></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><font face="arial, helvetica, sans-serif">Jon</font></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 January 2017 at 08:48, Paul Eggert <span dir="ltr"><<a href="mailto:eggert@cs.ucla.edu" target="_blank">eggert@cs.ucla.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When the time zone has UT offset 0 and the time zone abbreviation<br>
begins with "-", the %z spec now expands to -0000 instead of to<br>
+0000. This conveys more-useful info, and is what the next<br>
version of GNU 'date' is intended to do.<br>
* NEWS, newstrftime.3: Document change.<br>
* date.1: Document %z.<br>
* strftime.c (_fmt): Implement change.<br>
---<br>
NEWS | 4 ++++<br>
date.1 | 1 +<br>
newstrftime.3 | 12 ++++++++++++<br>
strftime.c | 13 ++++++++++++-<br>
4 files changed, 29 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/NEWS b/NEWS<br>
index 8276cc7..3975295 100644<br>
--- a/NEWS<br>
+++ b/NEWS<br>
@@ -74,6 +74,10 @@ Unreleased, experimental changes<br>
when TZ is set to a POSIX-style string that specifies DST.<br>
(Problem reported by Kees Dekker.)<br>
<br>
+ date and strftime now cause %z to generate "-0000" instead of<br>
+ "+0000" when the UT offset is zero and the time zone abbreviation<br>
+ begins with "-".<br>
+<br>
Changes to documentation and commentary<br>
<br>
tz-link.htm now covers leap smearing, which is popular in clouds.<br>
diff --git a/date.1 b/date.1<br>
index 7fd4848..579ab92 100644<br>
--- a/date.1<br>
+++ b/date.1<br>
@@ -90,6 +90,7 @@ to be output in a particular way<br>
%X 14:54:40 Time*<br>
%y 89 Last two digits of year<br>
%Y 1989 Year in full<br>
+%z -0500 Numeric time zone<br>
%Z EST Time zone abbreviation<br>
%+ Wed Mar 8 14:54:40 EST 1989 Default output format*<br>
.if t .in -.5i<br>
diff --git a/newstrftime.3 b/newstrftime.3<br>
index 9a60ee3..8f1be34 100644<br>
--- a/newstrftime.3<br>
+++ b/newstrftime.3<br>
@@ -50,6 +50,13 @@ strftime \- format date and time<br>
.SH DESCRIPTION<br>
.ie '\(en'' .ds en \-<br>
.el .ds en \(en<br>
+.ie '\(lq'' .ds lq \&"\"<br>
+.el .ds lq \(lq\"<br>
+.ie '\(rq'' .ds rq \&"\"<br>
+.el .ds rq \(rq\"<br>
+.de q<br>
+\\$3\*(lq\\$1\*(rq\\$2<br>
+..<br>
The<br>
.I strftime<br>
function formats the information from<br>
@@ -211,6 +218,11 @@ is replaced by the offset from the Prime Meridian<br>
in the format +HHMM or \*-HHMM as appropriate,<br>
with positive values representing locations east of Greenwich,<br>
or by the empty string if this is not determinable.<br>
+The numeric time zone \*-0000 is used when the time is Universal Time<br>
+but local time is indeterminate; by convention this is used for<br>
+locations while uninhabited, and corresponds to a zero offset when the<br>
+time zone abbreviation begins with<br>
+.q "\*-" .<br>
.TP<br>
%%<br>
is replaced by a single %.<br>
diff --git a/strftime.c b/strftime.c<br>
index 984ead5..2bfb6c1 100644<br>
--- a/strftime.c<br>
+++ b/strftime.c<br>
@@ -500,6 +500,7 @@ label:<br>
{<br>
long diff;<br>
char const * sign;<br>
+ bool negative;<br>
<br>
# ifdef TM_GMTOFF<br>
diff = t->TM_GMTOFF;<br>
@@ -538,7 +539,17 @@ label:<br>
continue;<br>
# endif<br>
# endif<br>
- if (diff < 0) {<br>
+ negative = diff < 0;<br>
+ if (diff == 0) {<br>
+#ifdef TM_ZONE<br>
+ negative = t->TM_ZONE[0] == '-';<br>
+#else<br>
+ negative<br>
+ = (t->tm_isdst < 0<br>
+ || tzname[t->tm_isdst != 0][0] == '-');<br>
+#endif<br>
+ }<br>
+ if (negative) {<br>
sign = "-";<br>
diff = -diff;<br>
} else sign = "+";<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
</font></span></blockquote></div><br></div>