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#21912: TAI<->UTC conversion botches the unknown Date: Mon, 22 Oct 2018 01:54:11 -0400 Message-ID: <871s8ia5mk.fsf@netris.org> References: <20151113164427.GS13455@fysh.org> <87woqc2r5x.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1540187587 30820 195.159.176.226 (22 Oct 2018 05:53:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 Oct 2018 05:53:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: zefram@fysh.org, 21912@debbugs.gnu.org To: John Cowan Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Oct 22 07:53:03 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 1gET9C-0007sf-QJ for guile-bugs@m.gmane.org; Mon, 22 Oct 2018 07:53:02 +0200 Original-Received: from localhost ([::1]:33130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gETBJ-0005kF-2W for guile-bugs@m.gmane.org; Mon, 22 Oct 2018 01:55:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gETBC-0005ix-3M for bug-guile@gnu.org; Mon, 22 Oct 2018 01:55:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gETB7-0001Xg-VD for bug-guile@gnu.org; Mon, 22 Oct 2018 01:55:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58998) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gETB7-0001XO-QE for bug-guile@gnu.org; Mon, 22 Oct 2018 01:55:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gETB7-0002M5-Li for bug-guile@gnu.org; Mon, 22 Oct 2018 01:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 22 Oct 2018 05:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21912 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 21912-submit@debbugs.gnu.org id=B21912.15401876749011 (code B ref 21912); Mon, 22 Oct 2018 05:55:01 +0000 Original-Received: (at 21912) by debbugs.gnu.org; 22 Oct 2018 05:54:34 +0000 Original-Received: from localhost ([127.0.0.1]:35023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gETAf-0002LG-Rz for submit@debbugs.gnu.org; Mon, 22 Oct 2018 01:54:34 -0400 Original-Received: from world.peace.net ([64.112.178.59]:52910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gETAd-0002Kz-0Z for 21912@debbugs.gnu.org; Mon, 22 Oct 2018 01:54:32 -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 1gETAW-0007oe-Aj; Mon, 22 Oct 2018 01:54:24 -0400 In-Reply-To: (John Cowan's message of "Sun, 21 Oct 2018 08:50:38 -0400") 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:9238 Archived-At: Hi John, John Cowan writes: > What is more, there are no TAI<->UTC conversion tables from before > 1961 (when UTC began) and probably never will be. There was heated > debate in the R7RS-small working group, and we finally settled on a > compromise: > > (current-second) [r]eturns an inexact number representing the current > time on the International Atomic Time (TAI) scale. The value 0.0 > represents midnight on January 1, 1970 TAI (equivalent to ten seconds > before midnight Universal Time) and the value 1.0 represents one TAI > second later. Neither high accuracy nor high precision are required; > in particular, returning Coordinated Universal Time plus a suitable > constant might be the best an implementation can do. > > I now see that the "ten seconds" is incorrect, and I am filing an > erratum: the correct figure is 4.2131700 seconds per > . Actually, the correct TAI-UTC delta on January 1, 1970 TAI is approximately 8 seconds. You are misinterpreting the relevant line from that file: 1968 FEB 1 =JD 2439887.5 TAI-UTC= 4.2131700 S + (MJD - 39126.) X 0.002592 S This means that TAI-UTC = 4.2131700 + (MJD - 39126) * 0.002592, where MJD is the modified julian day of the desired TAI-UTC delta. In this case, the MJD (modified julian day) of midnight UTC January 1, 1970 is 40587, and plugging that into the equation above yields TAI-UTC = 8.000082 seconds. If you are doubtful, see the "Atomic Time and Leap Seconds" graph, which shows a graph of TAI-UTC over the years 1958 to 2017, on the following page: http://jjy.nict.go.jp/mission/page1-e.html Note that between January 1961 and January 1972, the TAI-UTC delta was not an integer, and instead of the discontinuous leap second jumps that we've had since 1972, the two clocks ran at different rates in those years. Mark