[phobos] Status of std.gregorian
Jonathan M Davis
jmdavisprog at gmail.com
Sun Aug 15 06:15:28 PDT 2010
On Sunday 15 August 2010 05:36:08 Andrei Alexandrescu wrote:
> Thanks for your work, Jonathan. Our decision after the issue with
> Tango's date and time was to use Boost's. I'd started std.gregorian as a
> seed of a port of Boost's date and time, in the hope that someone will
> continue it. Jeff Garland (Boost's date/time author) has been very
> supportive in the matter.
>
> I very strongly suggest to stick with copying Boost's or C++0x's date
> and time facilities, unless we find some clearly superior ways
> facilitated by D's features. Developing our own date/time library from
> scratch risks of being at best just as capable as Boost/C++0x but
> guaranteed unfamiliar to everyone.
>
>
> Andrei
Well, I didn't entirely toss out what std.gregorian is up to. I need to look at
Boost's stuff in either case, but its internal implementation for date with using
the number of days since the beginning of the calendar as its measurement seems
to complicate things considerably and end up being less efficient in general. My
current implementation is using a split year, month, and day approach. The code
is way clearer, and the resulting struct actually takes up less space (6 bytes
instead of 8 with all 3 values being shorts or ushorts). Regardless, I'll have
to look at Boost's implementation to see exactly what they're up to. My primary
concern as a user of a date/time library, however, is that time always be held
internally in UTC, and the docs don't give the impression that that's the case
for Boost, so if I have a choice in the matter, and they are indeed not keeping
time in UTC at all times, I'm going to implement it differently. They're also
lacking functions that I've seen in other libraries (like Java) which seem
pretty basic - such as the ability to add or subtract months and years to/from a
date. So, I'll continue working on it, keeping in mind that you'd like it to
more or less follow Boost, and we'll see what you think of it when I'm done.
Personally, I'm more familiar with Java's and Qt's libraries, which are a fair
bit different from Boost (and different from each other for that matter). I've
never used one that I entirely liked though. Regardless, I'd like Phobos'
date/time functionality to be powerful, _correct_ (particularly with regards to
DST and the like), and user-friendly.
- Jonathan M Davis
More information about the phobos
mailing list