comp.lang.ada
 help / color / mirror / Atom feed
From: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
Subject: Re: Calling C time function from ADA-95
Date: 1998/06/09
Date: 1998-06-09T00:00:00+00:00	[thread overview]
Message-ID: <357D6F53.46486039@cl.cam.ac.uk> (raw)
In-Reply-To: 357D5083.45CB71F1@earthling.net


Charles Hixson wrote:
> I think that times should be kept on a kind of sliding scale.  Say
> seconds for the current decade, minutes for the current century, hours
> for the current 100 centuries.  Days for the current 10,000 centuries.
> Etc.

That sounds like a revolutionary new concept, but somehow I remember
having heard one of our Computer Science professors telling us already
about such advanced mechanisms for representing scalar values.
Isn't this stuff called "floating point numbers" or so?  :-)

> That should be sufficient overkill for ANYONE that would be
> satisfied by the current date structure anyway.

Just use a 64-bit integer counter for the seconds since some epoch,
which will last for the next 290 billion years (and goes backwards
far beyond the big bang). Add a 32-bit counter with the number
of nanoseconds since the last second started, and you get a
resolution that is an order of magnitude better than your CPU
frequency and the accuracy of good atomic clocks. The 32-bit
nanosecond counter has the nice property that inserted
leap seconds in your time scale (say UTC) can be represented
nicely as values 10**9..2*10**9-1.

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




  reply	other threads:[~1998-06-09  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-07  0:00 Calling C time function from ADA-95 Faust!
1998-06-06  0:00 ` Matthew Heaney
1998-06-08  0:00   ` Charles Hixson
1998-06-08  0:00     ` Dale Stanbrough
1998-06-08  0:00       ` Larry Kilgallen
1998-06-09  0:00       ` Markus Kuhn
1998-06-09  0:00         ` Charles Hixson
1998-06-09  0:00           ` Markus Kuhn [this message]
1998-06-09  0:00             ` Charles Hixson
1998-06-12  0:00               ` Larry Kilgallen
1998-06-07  0:00 ` Markus Kuhn
replies disabled

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