Epoch time + msecs
Handyman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Nov 13 10:00:13 PST 2015
How to get current time as a float (or a double or a real) as a
Unix epoch + milliseconds (e.g, 1447437383.465, or even
1447437383.46512 with finer resolution)? I read
http://dlang.org/intro-to-datetime.html and the docs of course.
I came this far
auto ct = Clock.currTime();
auto milliseconds = ct.fracSec.msecs;
auto epoch = ct.toUnixTime();
But I think this is not the shortest way and I don't know how to
combine and cast into a float (or a double or a real).
My goal was to multiply by 1000 and feed as this number as a seed
to D's random number generator. But there may be beter ways to
make a seed.
More information about the Digitalmars-d-learn
mailing list