Time from timestamp?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 2 07:06:55 PST 2015


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.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list