Convert SysTime to TickDuration?
Jonathan M Davis
jmdavisProg at gmx.com
Tue Nov 22 16:09:37 PST 2011
On Wednesday, November 23, 2011 01:01:54 Andrej Mitrovic wrote:
> I'm trying to port some Tango D1 code to D2, I don't know why ticks
> are used, but this was the code:
>
> timeModified = Path.modified(path).ticks;
>
> It fetches the modification date of a file and apparently converts
> that to ticks. I've tried using Phobos' std.file.timeLastModified
> which returns a SysTime, but I don't know how to convert that to
> ticks.
>
> Anyway, if that's not possible I'll just have to rewrite more code,
> it's not too big of a deal.
1. Conceptually, it really doesn't make sense. I have no idea why Tango is
doing that. I do recall Steven saying something about arguing with them about
using the same type for a time and a duration, so maybe that has something to
do with it.
2. I'd want to be _very_ certain that what they mean by ticks really are
system clock ticks. For instance, C# uses the term ticks to mean hnsecs since
January 1st, 1 A.D. at midnight (which is what SysTime uses internally and
what its stdTime property returns). If _that_ is what they mean, then it's as
easy as calling SysTime's stdTime. On the other hand, if they really means
system clock ticks, then what you want is indeed TickDuration. So, if you want
to port that code correctly, you're going to need to understand what Tango is
doing.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list