[D-runtime] druntime commit, revision 410
Fawzi Mohamed
fawzi at gmx.ch
Fri Nov 5 09:12:45 PDT 2010
On 5-nov-10, at 15:06, Sean Kelly wrote:
> On Nov 4, 2010, at 6:43 PM, Jonathan M Davis wrote:
>>
>> Looking at core.time, I'd really suggest just moving over
>> std.datetime.Duration
>> to core.time along with TickDuration, FracSec, and the dur!()
>> function for
>> creating Durations, possibly along with some of the helper
>> functions (which I
>> believe are primarily restricted to template constraints).
>
> Are there still 4 distinct duration types?
I really think that using doubles with the number of seconds for those
"normal" usages is really better.
That is what NSDate does (Next->Apple), and also libev.
QT on the other hand uses a structure similar to the *nix timings, and
Boost/std/tango
The advantage of double is that it is a simple type, and introduces 0
dependencies, and is still flexible enough for most uses.
Using integers one has to somehow give access to the time unit in some
way, and so make the interface more complex.
If different timers have different resolution different structures
have to be used.
Thus they lead to a more complex interface.
Converting various native timers to a double might cost a little bit,
but normally that is not a problem.
Still for the performance timers I did use an integer based timer
(uniform accuracy, and very small conversion cost).
Fawzi
More information about the D-runtime
mailing list