How to sleep accurately

Jason House jason.james.house at gmail.com
Wed Jun 27 20:05:52 PDT 2007


Daniel Giddings wrote:
> I'm not sure of the best way to do it but I'm interested in what people 
> think ;-)
> 
> You can use gettimeofday under linux instead of clock. It's in 
> std.c.linux.linux.
> 
> long getTime() // in ms
> {
>     timeval t;
>     struct_timezone z;
> 
>     gettimeofday(&t, &z);
> 
>     return t.tv_sec * 1000 + t.tv_usec / 1000;
> }

Thanks.  I'm using that and it seems to be working well...  I'll have to 
add some kind of check for the end of the day.  Will this have issues 
with daylight savings time?  Can I force it to use a timezone without that?


More information about the Digitalmars-d-learn mailing list