How to get current time as long or ulong?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 5 14:50:57 PDT 2016


On 7/5/16 3:51 PM, Charles Hixson via Digitalmars-d-learn wrote:
> On 07/05/2016 11:43 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
>> On Tuesday, July 05, 2016 11:16:31 Charles Hixson via Digitalmars-d-learn
>> wrote:
>>> What I'm looking for is the opposite of the "FromUnixTime" function.
>> SysTime has toUnixTime, which is right above fromUnixTime in the
>> documentation.
>>
>> But if what you want is a time_t, and you don't want to deal with
>> SysTime,
>> there's no point in using std.datetime. Just use core.time to call C's
>> time
>> function.
>>
>>
> That's what I want, but I'm worried by the documentation saying:
> " This has no relation to the wall clock time, as the wall clock time
> can be adjusted (e.g. by NTP), whereas the monotonic clock always moves
> forward."

Clock.currTime.toUnixTime? 
https://dlang.org/library/std/datetime/clock.curr_time.html

SysTime is just a type. What you are looking at is documentation for 
clock sources, not the type. Clock should give you the wall time.

-Steve


More information about the Digitalmars-d-learn mailing list