How to sleep accurately

Daniel Giddings danielg at microforte.com
Wed Jun 27 20:58:22 PDT 2007


I don't thin so, but to be honest I've never tried it. The man page 
indicates that the timezone field is obsolete and null can be passed:

http://www.rt.com/man/gettimeofday.2.html

Jason House wrote:
> 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