Converting Duration to TickDuration

Jonathan M Davis jmdavisProg at gmx.com
Mon Sep 12 20:27:44 PDT 2011


On Tuesday, September 13, 2011 05:13:02 Vladimir Panteleev wrote:
> On Tue, 13 Sep 2011 05:01:31 +0300, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > What are you doing that you want to create a TickDuration from a
> > Duration?
> 
> On the one side, I have a module for running scheduled events. Event
> timing is specified using a TickDuration, indicating the time interval
> after which to run the event.
> 
> On the other side, I have an application which replays an event log from a
> file. Events are timestamped in stdTime format, and are stored in SysTime
> instances. Subtracting one SysTime instance from another returns a
> Duration.

Personally, I'd just Duration far those and not TickDuration. Duration is just 
as precise (if not more precise) than TickDuration as long as the system ticks 
aren't less than 1 hnsec apart. TickDuration is useful in that it gives you 
timing in clock ticks if you need it (e.g. if the system clocks ticks were 
faster than 1 ever 1 hnsecs), but in the general case, it doesn't buy you 
anything over Duration, and I don't see why it would in your case either. 
Maybe something in how you're doing events?

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list