On 11/13/15 3:15 PM, Handyman wrote:
On Friday, 13 November 2015 at 18:27:42 UTC, Steven Schveighoffer wrote:
On 11/13/15 1:00 PM, Handyman wrote:
What I would do is this:

auto t = (Clock.currTime() - SysTime.fromUnixTime(0)).total!"msecs" /
1000.0

Thanks, Steve.

    import std.stdio;
    import std.datetime;

    void main() {
       auto t = (Clock.currTime() -
SysTime.fromUnixTime(0)).total!"msecs" / 1000.0;
       writeln(t);
    }

Gives an error: Error: no property 'fromUnixTime' for type 'SysTime'.

gah, fromUnixTime seems to have been added in 2.069. If you cannot update to the latest compiler, this should work:

auto t = (Clock.currTime() - SysTime(unixTimeToStdTime(0))).total!"msecs" / 1000.0

-Steve

Reply via email to