Convert SysTime to TickDuration?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Nov 22 18:54:40 PST 2011
On Wednesday, November 23, 2011 03:12:25 Andrej Mitrovic wrote:
> Interesting, it might just be stdTime like you've said. I do get a
> slightly different reading though:
>
> D2 Phobos:
> import std.stdio;
> import std.file;
> void main()
> {
> auto x = timeLastModified(`c:\test.d`).stdTime;
> writeln(x);
> }
>
> D1 Tango:
> import Path = tango.io.Path;
> import tango.io.Stdout;
> void main()
> {
> char[] path = `c:\test.d`;
> auto val = Path.modified(path).ticks;
> Stdout(val);
> }
>
> Phobos prints: 634576105879530000
> Tango prints: 634576105879531250
>
> It almost seems like Tango has more accuracy. Well in any case, this
> should work.
Exactly how precise it is depends on what's used to get the time, what OS your
on, etc. I don't know what Tango is doing, and particularly if you're on
Windows, it's possible that there's a better function to get the time than
std.datetime is using. I picked the best one that I could, but I don't
remember all of the details at this point, and I'm generally more familiar
with Linux.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list