[Balug-talk] Millisecond timeclock

Brian Sroufek brian_sroufek at msdesigninc.com
Thu Aug 2 11:41:53 PDT 2001


I've recently done the same work.
I acquired the appropriate calls by a knowledge
base Search in Microsoft 32 API().

The best way I have found to address this wicked
time portability issue is to write your own time
function with uses:

#ifdef M_WIN32
#elif defined M_UNIX
#ifdef M_LINUX
#endif
#endif

to make the appropriate calls for your particular
target.

Note that I have my own macros defined which I
define in a standard header so that my code doesn't
have to change with every release.

Cheers,

Brian

P.S.: I'll look in my code for the specific code.

Cheers,

Brian S.


Rick Moen wrote:

> begin Gern Blandsden quotation:
> > I'm doing some porting from Win32 to Linux that uses
> > PWLib as the framework.  The system requires a
> > reliable timeclock that reports with millisecond
> > precision.  In Win32, one uses timeGetTime() to get
> > the time from the multimedia timeclock -- a clock far
> > more acurate than the regular system timeclock.
> >
> > But I can't seem to find an equivalent for the Win32
> > timeGetTime() call.
>
> I'm not sure it's realistic to measure time at the millisecond level on
> other than a real-time OS.  Neither the Win32 OSes nor regular Linux
> qualifies -- though there are real-time Linux variants that do (and
> there's an unofficial kernel patch that purports to reduce system-time
> latency down to around the 4 msec level:
> http://linux.oreillynet.com/pub/a/linux/2000/11/17/low_latency.html)
>
> If a Win32 system call purports to measure reliably to that level of
> granularity, I'd suggest that it speaks with forked tongue.
>
> But anyway, returning to Linux, you might want to look into gettimeofday(2).
> http://www.die.net/doc/linux/man/man2/gettimeofday.2.html
>
> --
> Cheers,      "Transported to a surreal landscape, a young girl kills the first
> Rick Moen     woman she meets, and then teams up with three complete strangers
> rick at linuxmafia.com       to kill again."  -- Rick Polito's That TV Guy column,
>               describing the movie _The Wizard of Oz_
> _______________________________________________
> Balug-talk mailing list
> Balug-talk at balug.org
> http://www.balug.org/mailman/listinfo/balug-talk




More information about the Balug-talk-balug.org mailing list