www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Convert SysTime to TickDuration?

I need the number of ticks for a file's modification date.

module test;
import std.datetime;
import std.file;
import std.stdio;

void main()
    auto res1 = TickDuration(timeLastModified("test.d"));  // NG
    auto res2 = TickDuration.from!"hnsecs"(timeLastModified("test.d").stdTime);

First one doesn't work, and it's really a pain having to find all
these from/to/convert methods just to convert one value to another.

The second one returns a negative number, but I can't tell whether
this is right. Isn't the tick count supposed to be positive?

Tango had this method:

Very simple there.
Nov 22 2011