Convert TickDuration to Duration?

Jonathan M Davis jmdavisProg at gmx.com
Wed Jun 8 15:02:40 PDT 2011


On 2011-06-08 14:30, David Nadlinger wrote:
> On 6/8/11 11:14 PM, Jonathan M Davis wrote:
> > On 2011-06-08 13:36, David Nadlinger wrote:
> >> Did I miss a way to convert a TickDuration to a Duration? If there
> >> really is none, is there a reason for this?
> >> 
> >> Having to do an immediate conversion to a hnsecs long feels somehow odd:
> >> 
> >> ---
> >> Duration maxFlushInterval;
> >> if (dur!"hnsecs"(flushTimer.peek.hnsecs)> maxFlushInterval) { … }
> >> ---
> > 
> > Cast it. TickDuration overloaded opCast for Duration.
> > 
> > - Jonathan M Davis
> 
> Oh, of course, totally missed that.

I probably should provide an example for it in the documentation though, since 
it's something that you're likely to want to do.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list