On Tue, 27 Apr 2010 13:26:25 -0400, SHOO <[email protected]> wrote:
Michel Fortin さんは書きました:
On 2010-04-27 04:55:28 -0400, SHOO <[email protected]> said:
By these reasons, I made std.time module as the first step of the
contribution for Phobos.
Looks nice. I think defining structs as you did to handle date and
time is the way to go.
I've done something similar in the past to store dates and times which
I like a lot. What I did was just a storage format, but templates
allowed me to store dates and time spans with any precision while
exposing always the same public API.
I'm pasting my code below in case it can inspire you (note that this
code predates the new operator overloading syntax), and feel free to
use any of this under the Boost license if applicable.
In the code that I wrote, it can express Time until December 31, 9999.
And, the precision of Span is 100 nanoseconds order.
About the precision, I think that it is necessary and sufficient
condition.
Two other benefits to using 100NS increments: Windows FILETIME structures
use that same resolution, and Tango uses that same resolution. So we have
easy compatibility throughout many systems, while at the same time
capturing a wide enough range to last for 8000 years :)
-Steve