[phobos] std.datetime and tick types

Jonathan M Davis jmdavisProg at gmx.com
Mon Sep 27 00:20:04 PDT 2010


Okay, I'm approaching completion of my date/time code, and it looked like a good 
idea to use SHOO's stopwatch code that has now become the nascent std.datetime 
in order to get the current time (there's no need to duplicate code after all), 
and given that my code would have to be merged with his if it it's accepted, it 
seemed prudent to just merge them now (which I've now done). However, a bit of a 
naming issue has arisen.

SHOO has a struct called Ticks which holds a time in so-called system ticks, 
which is effectively the precision of the system clock - x ticks per second. So, 
the internal value's resolution varies from system to system. That's fine. The 
problem is that my code has a separate tick concept - that is 100ns is a tick. 
That is the precision that my SysTime struct holds when it holds the time. My 
date/time code considers tick a unit just as much as it considers days or 
seconds to be units. However, that makes it so that there are two types of 
ticks, and I'm afraid that that is going to cause some confusion. For the 
moment, I've renamed my ticks to std ticks and tried to make the documentation 
clear on the matter, but it still risks being confusing.

So, I'm looking for suggestions as what to name my ticks (which are held as a 
long and aren't a struct at all) and what to name SHOO's Ticks struct. The best 
that I can think of at the moment is to rename mine std ticks (with StdTick 
being an alias for long) and rename SHOO's to SysTicks, PrecisionTicks, or 
ResTicks, or something similar, but it would be even better if we could come up 
with a term for one of them which wasn't ticks at all.

So, does anyone have any ideas on how to name these two concepts/types?

1. My ticks (which represent 100 ns and are units of time).

2. SHOO's Ticks, which is a struct which holds the time from the system clock in 
ticks with the number of ticks per second varying with the system clock.

- Jonathan M Davis


More information about the phobos mailing list