comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Inserting Calendar.Time in a database
Date: Wed, 25 Aug 2004 09:24:48 +0200
Date: 2004-08-25T09:24:48+02:00	[thread overview]
Message-ID: <poqdv57eopmp$.z8pwmifutqaq.dlg@40tude.net> (raw)
In-Reply-To: psOdnQOXyd96CLbcRVn-oQ@megapath.net

On Tue, 24 Aug 2004 14:25:19 -0500, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:1jgik0ntrex36$.1pyha1husddpe.dlg@40tude.net...
> ...
>> I see a problem with it. UTC_Time_Offset is not constant, so there also
>> should be an atomic way to get exact UTC. Actually Ada.Real_Time.Time
>> seems a better candidate for UTC. I would add it there.
> 
> This is a gross misunderstanding of Ada's clock packages. Ada.Calendar is
> about time related to an external (standard) timebase, like UTC or CDT.
> Ada.Real_Time is about time related to an internal timebase. There is no
> defined relationship between Calendar and Real_Time, and that's intentional.
> Real_Time would typically be implemented with a hardware counter (such as
> QueryPerformanceCount on Windows).

So should UTC clock. The major application area of UTC is time stamping in
distributed applications. The requirements on time stamps are very
different from of Ada.Calendar.Time. The source of clock synchronization is
less important. A pedant would say that the source is always external.
Quartz generators are not written in Ada, yet (:-)) It is no matter whether
the clock is synchronized with a radio source or an internal quartz. Clock
behavior matters.

> Moreover, Ada.Real_Time has no concept of dates, which is critical to using
> a UTC time. Adding all of that to Ada.Real_Time would just make it a clone
> of Calendar, which then would beg the question of why we need two different
> time packages.

For the same reason we have two of them now. The underlying clocks have
different behavior. My point is that the nature of UTC clock is closer to
one of real-time than to calendar.

>> It is not warranted [guarenteed] that Clock /= Clock.
> 
> Of course. How could it be? If two calls are sufficiently close together,
> the clock may not have ticked in the interval. That's true even for
> Ada.Real_Time.Clock; it only guarantees never to run backwards.

It is a requirement when UTC is used for time stamping. Should
Ada.Universal_Time be implemented as a separate package, one could fulfill
it. For example, Clock could block until a tick which will change the
result. It could be more than one, due to clock synchronization causing
ignoring some ticks. Of course Clock should be bounded. Alternatively one
could make clock reading artificially by adding "subtick" counter etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2004-08-25  7:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 13:44 Inserting Calendar.Time in a database Jano
2004-08-05 15:21 ` Dmitry A. Kazakov
2004-08-05 21:19   ` Martin Dowie
2004-08-06  6:31     ` Jano
2004-08-06 11:32       ` Peter Hermann
2004-08-06 11:40         ` Duncan Sands
2004-08-08 11:10           ` Jano
2004-08-06  7:48     ` Dmitry A. Kazakov
2004-08-06  9:28       ` Martin Dowie
2004-08-06 10:44         ` Dmitry A. Kazakov
2004-08-07  9:50           ` Martin Dowie
2004-08-07 20:32             ` Dmitry A. Kazakov
2004-08-08  8:35               ` Martin Dowie
2004-08-08 11:03                 ` Simon Wright
2004-08-09  7:46                 ` Dmitry A. Kazakov
2004-08-09 17:54                   ` Nick Roberts
2004-08-10  7:33                     ` Dmitry A. Kazakov
2004-08-10  8:36                     ` John B. Matthews
2004-08-10 18:51                       ` Nick Roberts
2004-08-11  1:14                         ` John B. Matthews
2004-08-19  4:10                         ` Jano
2004-08-19  4:10                       ` Jano
2004-08-09 11:52                 ` Frank J. Lhota
2004-08-08 10:46       ` Simon Wright
2004-08-09  8:02         ` Dmitry A. Kazakov
2004-08-24 19:25       ` Randy Brukardt
2004-08-25  7:24         ` Dmitry A. Kazakov [this message]
2004-08-25  8:18           ` Martin Dowie
2004-08-25  9:25             ` Dmitry A. Kazakov
2004-08-25  9:42               ` Martin Dowie
2004-08-26  5:26               ` Simon Wright
2004-08-26  0:49           ` Randy Brukardt
2004-08-26  9:30             ` Dmitry A. Kazakov
2004-08-26 10:11               ` Martin Dowie
2004-08-26 10:58                 ` Dmitry A. Kazakov
2004-08-26 12:32                   ` Martin Dowie
2004-08-26 16:26                     ` Dmitry A. Kazakov
2004-08-26 17:23                       ` Martin Dowie
2004-08-26 18:55               ` Randy Brukardt
2004-08-26 20:04                 ` Dmitry A. Kazakov
2004-08-26  5:22           ` Simon Wright
replies disabled

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