[SDL] Milliseconds on the Mac

Mike Powell belar at earthling.net
Sun Apr 30 18:06:02 PDT 2000


>#include <Timer.h>
>
>UnsignedWide time;
>
>MicroSeconds (&time);
>
>The low word of time variable is the number of milliseconds (with 20
>microsecond error), since the computer has booted up. I am not sure what the
>high word is for, but I assume it is rarely used.
>
>so to get the microseconds, you do :
>
>UInt32 microseconds = time.lo;
>
>Keep in mind that MicroSeconds() is several times slower (I don't know
>exactly) than LMGetTicks (), which is what SDL is using right now.

Actually, the docs on Microseconds() on Apple's site say that it 
merely returns the time in Microseconds since some date in 1904. It's 
really just a 64-bit int that it returns, but, according to the docs, 
there was no way to make a 64 bit int, so they broke it into two 32 
bit ints in a struct. The hi and lo elements are just the high and 
low order 32 bits.

      ,---------------------------------------------------------.
     / _/_/_/    _/_/_/  _/        _/    _/_/   Michael Powell  /
    / _/    _/  _/      _/      _/  _/  _/  _/                 /
   / _/_/_/    _/_/    _/      _/_/_/  _/_/     Aspiring      /
  / _/    _/  _/      _/      _/  _/  _/  _/   Video Game    /
/ _/_/_/    _/_/_/  _/_/_/  _/  _/  _/  _/   Programmer    /
`---------------------------------------------------------'



More information about the SDL mailing list