On Sep 16, 2010, at 7:38 PM, Walter Bright wrote: > > Sean Kelly wrote: >> >> There are a bunch of routines in druntime that could really use a structured >> timespan representation (Boost actually even uses a full SystemTime class >> for most of these) and I'm trying to work out the best way to do this. In >> Tango, the decision was to have the routines all accept a long value that is >> the same resolution as the tick count from TimeSpan, which is why everything >> currently works as it does. I've always hated this and would love to do >> something more structured, but complications arise from possible redundancy >> or incompatibility with std.time. What I've done for now is duplicate >> Boost's time_duration struct (as TimeDuration) into core.time, and I'm >> looking at using this for Thread.sleep(), etc. Thoughts? >> >> > > I thought Tango used a floating point representation of time? (BTW, I think > such a representation is a mistake for various reasons.)
First let me qualify this by saying that my knowledge of Tango is a few years out of date. Tango used a double to represent timespans for a while, but once the time modules were created it switched to using a long representing tick count (100ns resolution). I lobbied for using the TimeSpan struct directly and the idea was vetoed. So you'd do something like: Thread.sleep(TimeSpan.fromSeconds(1).toTicks()); I can't remember the exact syntax, but it was along those lines. _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
