Useful D snippets

From D Wiki
Jump to: navigation, search

Converting a time_t unix timestamp into std.datetime types

http://dlang.org/intro-to-datetime.html

import std.datetime;
import core.stdc.time;
void main() {
    time_t unixTime = core.stdc.time.time(null);
    auto stdTime = unixTimeToStdTime(unixTime);
    auto st = SysTime(stdTime);
}