On Sun, 1 Aug 1999, Richard Gaskin wrote:

> It seems that milliseconds is more like seconds than ticks, in that it is 
> based on a fixed start time, while ticks is based on the moment the 
> program started.  This is an important distinction when needing to 
> generate unique numers which may be persistent across sessions.
> 
> A few questions about these:
> 
> 1. What is the base date for milliseconds?  Does it vary from machine to 
> machine?

It's the same as the seconds (the UNIX epoch, Jan 1, 1970), which is
the same reference point Windows OSs use.  It's the same on all
platforms, the MacOS value being calculated rather than being queried
directly from the OS.

> 2. Is this the same base date for seconds?

Yes.

> 3. Are ticks in MC truly relative to startup, as in other xTalks?

No.  The ticks, like the milliseconds, is based on the same time scale
as the seconds and so is consistent across platforms and across
reboots.  Using the TickCount() as the ticks, which I assume HyperCard
and SuperCard do, is a bad idea.  Not only does the value wrap every
so often, but it's not even guaranteed to be accurate because "ticks"
can be skipped and so the ticks sometimes won't match up with real
system time.

If you need a unique number based on a time stamp, I'd recommend using
"the long seconds", which returns a floating point number that is the
sum of the seconds and the milliseconds mod 1000.  I don't know for
sure that the milliseconds function will wrap at some point, but it
might.  We do know that the seconds function won't wrap until 2038, at
which point we figure that whatever OSs are available will have a
better way of doing things (like using 64-bit integers instead of
32-bit integers to store the time) and the upgrade will be transparent
to any stacks that survive until then ;-)
  Regards,
    Scott

> Thanks in advance - 
> 
> 
> 
> - Richard Gaskin 
>   Fourth World
>   Multimedia Design and Development for Mac, Windows, UNIX, and the Web
>   _____________________________________________________________________
>   [EMAIL PROTECTED]                 http://www.FourthWorld.com
>   US: 800-288-5825         Int'l: 323-225-3717        Fax: 323-225-0716
> 
> 

********************************************************
Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...

Reply via email to