On 2/2/15 10:06 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Monday, February 02, 2015 08:49:58 Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 1/31/15 1:07 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Friday, January 30, 2015 22:03:02 Jonathan M Davis via Digitalmars-d-learn
wrote:
Yeah. I really should add a unixTimeToSysTime function,
Actually, maybe it should be a static function on SysTime called
fromUnixTime to go with toUnixTime. I don't know. Regardless, it's a nicety
that should be there, and I botched things by not having it.
Might I suggest that you simply define an enum for UnixEpoch that's a
SysTime. Then you can do whatever you want.
Note that unixTimeToSysTime doesn't help the OP, his timestamp is in
milliseconds since 1/1/1970.
Then I should probably just do both - declare a function to do the
conversion (since that's more user-friendly for the common case) and supply
an enum for the unix epoch if someone is converting to something like
milliseconds instead of seconds for the unix epoch.
You already have various unixTimeToXXX functions, so it's probably moot,
but with an epoch, such operations are dead simple:
auto t = UnixEpoch + time().seconds;
I see very little value in a wrapper function to do this. But it's
already there, so...
BTW, I think with UFCS, having the 'seconds' etc. functions is one of
the coolest parts of D's time library. I love that part :)
-Steve