comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Ada.Calendar and NTP (and Unix Epoch)
Date: Tue, 24 Jul 2012 21:33:34 +0100
Date: 2012-07-24T21:33:34+01:00	[thread overview]
Message-ID: <m28ve8rja9.fsf@nidhoggr.home> (raw)
In-Reply-To: 60c9c92b-280b-4178-a410-2bc8756c6b5e@googlegroups.com

erlo.haugen@gmail.com writes:

>> My gut feeling is that if NTP gives you a time in the range 1-1-1900
>> to 12-31-1900, something is pretty wrong because computers
>> didn't exist during that time period.  So I'm not really
>> sure what the issue is.  I think you need to be more specific about
>> what you're trying to do.  What kind of value is your program
>> using for an "NTP time"--is it an integer, and if so, what
>> does it represent (seconds since 1-1-1900, nanoseconds since
>> 1-1-1900, or what)?  Are you trying to see if an NTP time is less
>> than or greater than a value of Ada.Calendar.Time, or compute the
>> difference in seconds (or something else) between an NTP time value
>> and an Ada.Calendar.Time value, or what?
>> 
>>                         -- Adam
> NTP epoch 1 started 1-1-1900 0:00, just like the Unix epoch started
> 1-1-1970 0:00. So when I get a time from an NTP-server, I get seconds
> from the start of the NTP epoch.

Yes; but if you regard the 64-bit value as a *signed* value then the
current NTP value is about -24 years. The next NTP epoch is in 2036,
which is easily representable in Ada.Calendar.Time. So, *add* -24 to
2036 and, presto, 2012! In UTC.

Of course, if you are worried about leap seconds, you are in for a world
of pain either way.

From Wikipedia[1],

   NTP delivers UTC time. UTC is subject to scheduled leap seconds to
   synchronize the timescale to the rotation of the earth. When a leap
   second is added, NTP is suspended for 1 second. Because NTP has no
   mechanism for remembering the history of leap seconds, leap seconds
   cause the entire NTP timescale to shift by 1 second.

[1] http://en.wikipedia.org/wiki/Network_Time_Protocol#Leap_seconds



  parent reply	other threads:[~2012-07-26 15:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 21:42 Ada.Calendar and NTP (and Unix Epoch) erlo
2012-07-23 22:07 ` Adam Beneschan
     [not found]   ` <5s8s08lv6dj1i4tkb99roq9roifsgr44vd@invalid.netcom.com>
2012-07-24  7:11     ` Dmitry A. Kazakov
2012-07-24  7:50       ` erlo.haugen
2012-07-24  8:14         ` Dmitry A. Kazakov
2012-07-24  8:34           ` erlo.haugen
2012-07-24  9:13             ` Dmitry A. Kazakov
2012-07-24 12:27               ` erlo.haugen
2012-07-24 13:02                 ` Dmitry A. Kazakov
2012-07-24 14:10                   ` erlo
2012-07-24 16:37                 ` Adam Beneschan
2012-07-24  7:24   ` erlo.haugen
2012-07-24 16:26     ` Adam Beneschan
2012-07-24 18:28       ` Dmitry A. Kazakov
2012-07-24 19:07         ` Adam Beneschan
2012-07-24 20:17           ` Dmitry A. Kazakov
2012-07-24 19:43         ` Vasiliy Molostov
2012-07-24 20:29           ` Dmitry A. Kazakov
2012-07-24 21:22             ` Vasiliy Molostov
2012-07-25  6:32               ` Dmitry A. Kazakov
2012-07-25  7:04                 ` Vasiliy Molostov
2012-07-25  7:33                   ` Dmitry A. Kazakov
2012-07-25  8:05                     ` Vasiliy Molostov
2012-07-25  8:30                       ` Dmitry A. Kazakov
2012-07-25  8:45                         ` Vasiliy Molostov
2012-07-25  9:30                           ` Dmitry A. Kazakov
2012-07-24 20:33     ` Simon Wright [this message]
2012-07-25 10:14       ` Simon Wright
2012-07-25 13:16         ` Dmitry A. Kazakov
2012-07-24  7:37   ` erlo.haugen
2012-07-24 11:34 ` Simon Wright
2012-07-24 11:59   ` Nasser M. Abbasi
2012-07-24 15:08     ` Simon Wright
2012-07-24 16:59       ` Georg Bauhaus
2012-07-24 19:25         ` Simon Wright
2012-07-24 22:07           ` Georg Bauhaus
2012-07-24 19:17     ` John B. Matthews
2012-07-25  2:23 ` sla29970
2012-07-25  6:40   ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox