diff options
| -rw-r--r-- | src/editfns.c | 3 | ||||
| -rw-r--r-- | test/src/editfns-tests.el | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c index b03eb947dec..2f8b075817a 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -187,7 +187,8 @@ tzlookup (Lisp_Object zone, bool settz) | |||
| 187 | if (sec != 0) | 187 | if (sec != 0) |
| 188 | prec += 2, numzone = 100 * numzone + sec; | 188 | prec += 2, numzone = 100 * numzone + sec; |
| 189 | } | 189 | } |
| 190 | sprintf (tzbuf, tzbuf_format, prec, numzone, | 190 | sprintf (tzbuf, tzbuf_format, prec, |
| 191 | XINT (zone) < 0 ? -numzone : numzone, | ||
| 191 | &"-"[XINT (zone) < 0], hour, min, sec); | 192 | &"-"[XINT (zone) < 0], hour, min, sec); |
| 192 | zone_string = tzbuf; | 193 | zone_string = tzbuf; |
| 193 | } | 194 | } |
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 1c3fde888f6..f910afaf711 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -166,6 +166,10 @@ | |||
| 166 | (should (string-equal | 166 | (should (string-equal |
| 167 | (format-time-string format look '(-28800 "PST")) | 167 | (format-time-string format look '(-28800 "PST")) |
| 168 | "1972-06-30 15:59:59.999 -0800 (PST)")) | 168 | "1972-06-30 15:59:59.999 -0800 (PST)")) |
| 169 | ;; Negative UTC offset, as a Lisp integer. | ||
| 170 | (should (string-equal | ||
| 171 | (format-time-string format look -28800) | ||
| 172 | "1972-06-30 15:59:59.999 -0800 (-08)")) | ||
| 169 | ;; Positive UTC offset that is not an hour multiple, as a string. | 173 | ;; Positive UTC offset that is not an hour multiple, as a string. |
| 170 | (should (string-equal | 174 | (should (string-equal |
| 171 | (format-time-string format look "IST-5:30") | 175 | (format-time-string format look "IST-5:30") |