Thread.sleep (DMD 2.020)

Steven Schveighoffer schveiguy at yahoo.com
Sun Nov 2 04:04:15 PST 2008


"Christopher Wright" wrote
> John C wrote:
>> Sean Kelly Wrote:
>>
>>> John C wrote:
>>>> Win32's Sleep(50) seems to be the same as Thread.sleep(500_000). Is 
>>>> that right?
>>> Yup.  There should probably be some sort of TimeSpan struct to help 
>>> prevent these mistakes.
>>>
>>>
>>> Aean
>>
>> That's why I wrote Mango's TimeSpan way back when...
>
> Unfortunately, at the moment, that would mean putting TimeSpan into 
> druntime (dcore?), which probably isn't going to happen.
>
> I hope that TimeSpan can make its way into a core part of Tango 
> eventually. Socket, for instance, uses struct timeval directly -- if I 
> recall correctly, client code has to construct timevals, and there's no 
> constructor provided.

Tango uses TimeSpan in most places (including Socket) except for core, which 
can't depend on other libs (TimeSpan resides in tango.time.Time).  In places 
where TimeSpan cannot be used, or where it was deemed undesirable, a double 
representing seconds is used.

My original intention for TimeSpan was for it to be in core for this reason, 
but I was overruled.  If I had it my way, TimeSpan would be the only 
representation of time in Tango.

-Steve 





More information about the Digitalmars-d mailing list