From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#21907: date->string duff ISO 8601 zone format Date: Fri, 13 Nov 2015 14:59:13 +0000 Message-ID: <20151113145913.GQ13455@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1447426822 10357 80.91.229.3 (13 Nov 2015 15:00:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Nov 2015 15:00:22 +0000 (UTC) To: 21907@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Nov 13 16:00:11 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZxFph-0001uY-W3 for guile-bugs@m.gmane.org; Fri, 13 Nov 2015 16:00:11 +0100 Original-Received: from localhost ([::1]:53492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxFph-0000H1-J8 for guile-bugs@m.gmane.org; Fri, 13 Nov 2015 10:00:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxFpd-0000FD-U8 for bug-guile@gnu.org; Fri, 13 Nov 2015 10:00:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxFpd-0006tl-17 for bug-guile@gnu.org; Fri, 13 Nov 2015 10:00:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxFpc-0006tc-VC for bug-guile@gnu.org; Fri, 13 Nov 2015 10:00:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZxFpc-0003S1-7P for bug-guile@gnu.org; Fri, 13 Nov 2015 10:00:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 13 Nov 2015 15:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21907 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144742678113204 (code B ref -1); Fri, 13 Nov 2015 15:00:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Nov 2015 14:59:41 +0000 Original-Received: from localhost ([127.0.0.1]:37324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxFpE-0003Qu-To for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:59:41 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59551) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxFou-0003QT-Hc for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:59:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxFot-0006gM-95 for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:59:20 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxFot-0006gC-5n for submit@debbugs.gnu.org; Fri, 13 Nov 2015 09:59:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxFos-0008Vl-8o for bug-guile@gnu.org; Fri, 13 Nov 2015 09:59:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxFor-0006eU-Bj for bug-guile@gnu.org; Fri, 13 Nov 2015 09:59:18 -0500 Original-Received: from river6.fysh.org ([2001:41d0:d:20da::2]:38133 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxFor-0006dH-5L for bug-guile@gnu.org; Fri, 13 Nov 2015 09:59:17 -0500 Original-Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1ZxFon-0002RE-Nu; Fri, 13 Nov 2015 14:59:13 +0000 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7901 Archived-At: scheme@(guile-user)> (use-modules (srfi srfi-19)) scheme@(guile-user)> (date->string (julian-day->date 2450000 3600) "~4") $1 = "1995-10-09T13:00:00+0100" scheme@(guile-user)> (date->string (julian-day->date 2450000 3630) "~4") $2 = "1995-10-09T13:00:30+0100" There are two problems here with date->string's representation of zone offsets for the ISO 8601 formats "~2" and "~4". Firstly, because the time-of-day is represented in the extended format with colon separators, the zone offset must also be represented with colon separators. So the first "+0100" above should be "+01:00". Secondly, the offset is being truncated to an integral minute, so the output doesn't fully represent the zone offset. More importantly, because the local time-of-day isn't being adjusted to match, it's not accurately representing the point in time. ISO 8601 doesn't permit a seconds component in the zone offset, so you have a choice of three not-entirely-satisfactory options. Firstly, you could round the zone offset and adjust the represented local time accordingly, so the 3630 conversion above would yield either "1995-10-09T13:00:00+01:00" or "1995-10-09T13:01:00+01:01". Secondly, you could use the obvious extension of the ISO 8601 format to a seconds component, outputting "1995-10-09T13:00:30+01:00:30". Or finally you could signal an error when trying to represent a zone offset that's not an integral minute. Incidentally, for offsets of -1 to -59 inclusive, the truncation isn't clearing the negative sign, so is producing the invalid output "-0000". The zero offset is required to be represented with a "+" sign. If you take the rounding option described above, anything that rounds to a zero-minutes offset must yield "+00:00" in the output. -zefram