unix time will need a wrapper for strong typing

struct UnixTime { int value; }
SysTime toSysTime(UnixTime fromValue, TimeZone zone=Utc)
{ return SysTime(unixTimeToStdTime(fromValue.value), zone); }

so conversion is

return UnixTime(d.when.time).toTime!DateTime;

may be it can be reduced to

return to!DateTime(UnixTime(d.when.time));

For primitive types one may have functions which convert directly to SysTime instead of wrappers, this will also enable overloading if someone uses wider types with the same semantics.

SysTime unixTime(time_t fromValue, TimeZone zone=Utc)
{ return SysTime(unixTimeToStdTime(fromValue), zone); }

return unixTime(d.when.time).toTime!DateTime;

strongly typed time formats with defined conversion method to and from SysTime will be just

FILETIME ft;
return ft.toTime!DateTime;

Reply via email to