unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Keith Wright <kwright@keithdiane.us>
To: gdt@ir.bbn.com
Cc: ludo@gnu.org, guile-user@gnu.org
Subject: Re: Leap second bug?
Date: Mon, 9 Jun 2008 13:18:26 -0400	[thread overview]
Message-ID: <200806091718.m59HIQPS013148@fcs13.keithdiane.us> (raw)
In-Reply-To: <rmik5gy3b9y.fsf@fnord.ir.bbn.com> (message from Greg Troxel on Mon, 09 Jun 2008 10:58:49 -0400)

> From: Greg Troxel <gdt@ir.bbn.com>
> 
> It seems very odd for time-utc->date to pay attention to leap seconds.
> I would only expect leap seconds to come into play when converting
> between UTC and TAI.

Procedure time-utc->date resents the anthropomorphism.

The author of that procedure probably paid some attention,
but not enough, otherwise the answer would be right.

> The whole point of UTC is to have a timescale with the same number
> of seconds per day so that one can ignore the mess of leap seconds.

I think this is provably false.  If anyone wants to argue, I will
look up original references, but for now I will just quote something
I wrote a few years ago, after spending much more time on this
issue than all the leap seconds in the history of the universe.

> UTC can not be expressed as a single number (in any units), but must
> be expressed as a day (either Julian Day or Gregorian Calendar
> Date), together with a time within that day (expressed as hours,
> minutes, and seconds, as total number of seconds, or as a fraction
> of a day).  This is because the days are not all the same length.
> Most of them are $86\,400$ seconds (exactly), but when a leap second
> is inserted the day is $86\,401$ seconds (exactly).

> With UTC, one represents seconds since the epoch in a way which does
> not count leap seconds.

UTC is _not_ expressed in seconds.

If it were, it would be messed up whenever a second
passed without incrementing the count.

>  With TAI, the count includes all seconds
> (TAI-UTC currently being 33)

This true (to within a second) and explains why
we don't use TIA much.  It's too hard to figure out
the date, which the boss cares about.

> (I would say that a time difference of two UTC times should return
> the arithmetic difference of the two seconds-since-epoch values, and
> of two TAI times the same thing, but the TAI ones will have leap
> seconds.  This is not clear in the srfi-19 text.)

The srfi says the input to time-utc->date is a of type
time-utc.  I don't find a definition of that in the srfi.
(There is a symbol with that name, but no type.)
It probably means a time object with component time-type
set to the symbol time-utc.  This is bad, because
a time object is a count of seconds, and UTC is not.

> So, I'd say time-utc->date doing any leap second lookups is a bug.

I don't know what a procedure should do if it is
based upon a spec that violates international standards.

> > Ondrej Zajicek <santiago@crfreenet.org> writes:
> >
> >> (date->str (time-utc->date (date->time-utc (str->date "01-01-2006"))))
> >> -> "31-12-2005"
> >>
> >> Is is a bug in leap second handling or is it a expected behavior?

I am open to argument on other things, but I am sure that
if this is expected behavior, it is bug in someone's expectations.

  -- Keith




  reply	other threads:[~2008-06-09 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-07 20:40 Leap second bug? Ondrej Zajicek
2008-06-08 19:45 ` Ondrej Zajicek
2008-06-08 22:00 ` Ludovic Courtès
2008-06-09 14:58   ` Greg Troxel
2008-06-09 17:18     ` Keith Wright [this message]
2008-06-10 15:15   ` Jon Wilson
2008-06-10 18:26     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806091718.m59HIQPS013148@fcs13.keithdiane.us \
    --to=kwright@keithdiane.us \
    --cc=gdt@ir.bbn.com \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).