From unknown Wed Jun 18 00:26:47 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#21911 <21911@debbugs.gnu.org> To: bug#21911 <21911@debbugs.gnu.org> Subject: Status: TAI-to-UTC conversion leaps at wrong time Reply-To: bug#21911 <21911@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:26:47 +0000 retitle 21911 TAI-to-UTC conversion leaps at wrong time reassign 21911 guile submitter 21911 Zefram severity 21911 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 13 11:20:35 2015 Received: (at submit) by debbugs.gnu.org; 13 Nov 2015 16:20:35 +0000 Received: from localhost ([127.0.0.1]:37372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxH5W-0008W1-Pz for submit@debbugs.gnu.org; Fri, 13 Nov 2015 11:20:35 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58418) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxH5B-0008Va-KY for submit@debbugs.gnu.org; Fri, 13 Nov 2015 11:20:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxH56-0006tW-DY for submit@debbugs.gnu.org; Fri, 13 Nov 2015 11:20:13 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxH56-0006tQ-AE for submit@debbugs.gnu.org; Fri, 13 Nov 2015 11:20:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxH52-0004mr-Bl for bug-guile@gnu.org; Fri, 13 Nov 2015 11:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxH51-0006s5-HX for bug-guile@gnu.org; Fri, 13 Nov 2015 11:20:04 -0500 Received: from river6.fysh.org ([2001:41d0:d:20da::2]:39596 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxH51-0006rq-Bj for bug-guile@gnu.org; Fri, 13 Nov 2015 11:20:03 -0500 Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1ZxH4x-00050S-0j; Fri, 13 Nov 2015 16:19:59 +0000 Date: Fri, 13 Nov 2015 16:19:58 +0000 From: Zefram To: bug-guile@gnu.org Subject: TAI-to-UTC conversion leaps at wrong time Message-ID: <20151113161958.GR13455@fysh.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Probing the TAI-to-UTC conversion offered by srfi-19's time-tai->date, in the minutes around the leap second in 2012: scheme@(guile-user)> (use-modules (srfi srfi-19)) scheme@(guile-user)> (for-each (lambda (d) (write (list d (date->string (time-tai->date (add-duration (julian-day->time-tai 2456109) (make-time time-duration 0 d)) 0) "~4"))) (newline)) (list 43000 43160 43164 43165 43166 43167 43199 43200 43201 43202)) (43000 "2012-06-30T23:56:40Z") (43160 "2012-06-30T23:59:20Z") (43164 "2012-06-30T23:59:24Z") (43165 "2012-06-30T23:59:25Z") (43166 "2012-06-30T23:59:25Z") (43167 "2012-06-30T23:59:26Z") (43199 "2012-06-30T23:59:58Z") (43200 "2012-06-30T23:59:59Z") (43201 "2012-06-30T23:59:60Z") (43202 "2012-07-01T00:00:01Z") The julian-day->time-tai conversion is correct (the JD refers to 2012-06-30T12:00:00 UTC, which is 2012-06-30T12:00:34 TAI), and the duration addition works in a perfectly regular manner in TAI space. All the interesting stuff happens in the TAI-to-UTC conversion, between the time-tai structure and the date structure. The same thing happens if the conversion is performed by separate time-tai->time-utc and time-utc->date calls. The date->string part is correct and uninteresting. The conversion is initially correct, minutes before midnight, but a discontinuity is seen 35 seconds before midnight. Outputs from then up to one second after midnight are one second slow. At one second after midnight it recovers. Because 35 seconds happens to be the TAI-UTC difference prevailing immediately after this leap second, I suspect that this is down to a time_t value (as used in the time-utc structure) for the moment of the leap being misinterpreted as a time-tai seconds value. The UTC-to-TAI conversion is in better shape. As a result, time-tai->time-utc and time-utc->time-tai are not inverses during the 35 second erroneous period. Round-tripping through the two conversions produces an output not matching the input. -zefram From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 20 17:31:08 2018 Received: (at 21911-done) by debbugs.gnu.org; 20 Oct 2018 21:31:08 +0000 Received: from localhost ([127.0.0.1]:33511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDypw-0006d6-5e for submit@debbugs.gnu.org; Sat, 20 Oct 2018 17:31:08 -0400 Received: from world.peace.net ([64.112.178.59]:59838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDypr-0006cZ-W3 for 21911-done@debbugs.gnu.org; Sat, 20 Oct 2018 17:31:04 -0400 Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDypl-0007j4-W5; Sat, 20 Oct 2018 17:30:58 -0400 From: Mark H Weaver To: Zefram Subject: Re: bug#21911: TAI-to-UTC conversion leaps at wrong time References: <20151113161958.GR13455@fysh.org> Date: Sat, 20 Oct 2018 17:30:42 -0400 In-Reply-To: <20151113161958.GR13455@fysh.org> (Zefram's message of "Fri, 13 Nov 2015 16:19:58 +0000") Message-ID: <87efck4871.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21911-done Cc: 21911-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Zefram writes: > Probing the TAI-to-UTC conversion offered by srfi-19's time-tai->date, > in the minutes around the leap second in 2012: > > scheme@(guile-user)> (use-modules (srfi srfi-19)) > scheme@(guile-user)> (for-each (lambda (d) (write (list d > (date->string (time-tai->date (add-duration (julian-day->time-tai > 2456109) (make-time time-duration 0 d)) 0) "~4"))) (newline)) (list > 43000 43160 43164 43165 43166 43167 43199 43200 43201 43202)) > (43000 "2012-06-30T23:56:40Z") > (43160 "2012-06-30T23:59:20Z") > (43164 "2012-06-30T23:59:24Z") > (43165 "2012-06-30T23:59:25Z") > (43166 "2012-06-30T23:59:25Z") > (43167 "2012-06-30T23:59:26Z") > (43199 "2012-06-30T23:59:58Z") > (43200 "2012-06-30T23:59:59Z") > (43201 "2012-06-30T23:59:60Z") > (43202 "2012-07-01T00:00:01Z") This is fixed by commit 5106377a3460e1e35daf14ea6edbe80426347155 on the stable-2.2 branch. I'm closing this bug now, but feel free to reopen if appropriate. Thanks! Mark From unknown Wed Jun 18 00:26:47 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Nov 2018 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator