[phobos] Status of std.gregorian

Jonathan M Davis jmdavisprog at gmail.com
Sun Aug 15 04:40:08 PDT 2010


On Sunday 15 August 2010 03:17:27 Shin Fujishiro wrote:
> Jonathan M Davis <jmdavisprog at gmail.com> wrote:
> > In any case, ideally, whatever we do for time/date in Phobos is in UTC
> > internally and properly handles conversions to other timezones upon
> > request, but it isn't ever actually in another timezone internally.
> 
> Thank you for the detailed description!  Now I convinced that the
> time value must be held in UTC always.
> 
> Then, if I understand correctly, the time object must hold a UTC time
> value alongside timezone information.
> 
> struct Time
> {
>     ulong utc;
>     Timezone tz;
> }
> 
> ... and timezone conversions are done by just replacing the tz member.
> 
> 
> Shin

Yes. That's basically what you do. The key is to never actually convert whatever 
you're using to hold time (be it a time_t or whatever) into the local time zone. 
It must stay in UTC.

- Jonathan M Davis


More information about the phobos mailing list