From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#26632: TAI<->UTC conversion botches 1961 to 1971 Date: Wed, 24 Oct 2018 01:57:33 -0400 Message-ID: <87zhv3yjhu.fsf@netris.org> References: <20170424010218.GL6765@fysh.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1540360577 13028 195.159.176.226 (24 Oct 2018 05:56:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 24 Oct 2018 05:56:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 26632@debbugs.gnu.org To: Zefram Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed Oct 24 07:56:13 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFC9K-0003F8-RV for guile-bugs@m.gmane.org; Wed, 24 Oct 2018 07:56:11 +0200 Original-Received: from localhost ([::1]:46141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFCBR-0001tf-3F for guile-bugs@m.gmane.org; Wed, 24 Oct 2018 01:58:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFCBJ-0001tD-B1 for bug-guile@gnu.org; Wed, 24 Oct 2018 01:58:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFCBA-0002nt-Ab for bug-guile@gnu.org; Wed, 24 Oct 2018 01:58:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34771) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gFCB8-0002nF-Hl for bug-guile@gnu.org; Wed, 24 Oct 2018 01:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gFCB8-0005Dp-8H for bug-guile@gnu.org; Wed, 24 Oct 2018 01:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 24 Oct 2018 05:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26632 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 26632-submit@debbugs.gnu.org id=B26632.154036067820064 (code B ref 26632); Wed, 24 Oct 2018 05:58:02 +0000 Original-Received: (at 26632) by debbugs.gnu.org; 24 Oct 2018 05:57:58 +0000 Original-Received: from localhost ([127.0.0.1]:39029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFCB4-0005DY-5q for submit@debbugs.gnu.org; Wed, 24 Oct 2018 01:57:58 -0400 Original-Received: from world.peace.net ([64.112.178.59]:60528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFCAz-0005DI-RM for 26632@debbugs.gnu.org; Wed, 24 Oct 2018 01:57:55 -0400 Original-Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gFCAs-0004yF-Dx; Wed, 24 Oct 2018 01:57:47 -0400 In-Reply-To: <20170424010218.GL6765@fysh.org> (Zefram's message of "Mon, 24 Apr 2017 02:02:18 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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" Xref: news.gmane.org gmane.lisp.guile.bugs:9243 Archived-At: --=-=-= Content-Type: text/plain Hi Zefram, Zefram writes: > The SRFI-19 library gets TAI<->UTC conversions badly wrong in the years > 1961 to 1971 (inclusive). Indeed. > This has to be examined somewhat indirectly, because SRFI-19 doesn't offer > any way to display a TAI time in its conventional form as a date-like > structure, nor to input a TAI time from such a structure. FWIW, here are two procedures I hacked up to support TAI dates: --8<---------------cut here---------------start------------->8--- (define (time-tai->date-tai t . tz-offset) (apply time-tai->date (time-utc->time-tai! (make-time time-utc (time-nanosecond t) (time-second t))) tz-offset)) (define (date-tai->time-tai d) (let ((t (time-tai->time-utc (date->time-tai d)))) (set-time-type! t time-tai) t)) --8<---------------cut here---------------end--------------->8--- > SRFI-19's date structure, as implemented, is always interpreted > according to UTC. Indeed, I discovered this as well, and found it surprising. The text of SRFI-19 fails to mention it, but the reference implementation makes it quite clear. > First I'll consider an ordinary day in 1967: > > scheme@(guile-user)> (use-modules (srfi srfi-19)) > scheme@(guile-user)> (time-difference > ... (time-utc->time-tai (date->time-utc (make-date 0 0 0 0 15 3 1967 0))) > ... (time-utc->time-tai (date->time-utc (make-date 0 0 0 0 14 3 1967 0)))) > $1 = #