<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 &quot;-00:00&quot;.  This differs<br>   semantically from an offset of &quot;Z&quot; or &quot;+00:00&quot;, 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&#39;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&#39;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">&lt;<a href="mailto:eggert@cs.ucla.edu" target="_blank">eggert@cs.ucla.edu</a>&gt;</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 &quot;-&quot;, 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 &#39;date&#39; 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 &quot;-0000&quot; instead of<br>
+    &quot;+0000&quot; when the UT offset is zero and the time zone abbreviation<br>
+    begins with &quot;-&quot;.<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 &#39;\(en&#39;&#39; .ds en \-<br>
 .el .ds en \(en<br>
+.ie &#39;\(lq&#39;&#39; .ds lq \&amp;&quot;\&quot;<br>
+.el .ds lq \(lq\&quot;<br>
+.ie &#39;\(rq&#39;&#39; .ds rq \&amp;&quot;\&quot;<br>
+.el .ds rq \(rq\&quot;<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 &quot;\*-&quot; .<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-&gt;TM_GMTOFF;<br>
@@ -538,7 +539,17 @@ label:<br>
                                        continue;<br>
 #  endif<br>
 # endif<br>
-                               if (diff &lt; 0) {<br>
+                               negative = diff &lt; 0;<br>
+                               if (diff == 0) {<br>
+#ifdef TM_ZONE<br>
+                                 negative = t-&gt;TM_ZONE[0] == &#39;-&#39;;<br>
+#else<br>
+                                 negative<br>
+                                   = (t-&gt;tm_isdst &lt; 0<br>
+                                      || tzname[t-&gt;tm_isdst != 0][0] == &#39;-&#39;);<br>
+#endif<br>
+                               }<br>
+                               if (negative) {<br>
                                        sign = &quot;-&quot;;<br>
                                        diff = -diff;<br>
                                } else  sign = &quot;+&quot;;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
</font></span></blockquote></div><br></div>