[phobos] datetime review
Jonathan M Davis
jmdavisProg at gmx.com
Sat Oct 9 04:29:59 PDT 2010
On Saturday 09 October 2010 04:16:59 Michel Fortin wrote:
> Le 2010-10-09 à 1:47, Jonathan M Davis a écrit :
> > Which is why PosixTimeZone and WindowsTimeZone will be getting that
> > information from the OS, but the OS does not make it easy. On Posix, you
> > have to actually read in the time zone files from disk, and on Windows,
> > you have to read the registry. No system calls are provided to properly
> > deal with time zones. Honestly, time zone support for anything other
> > than the local time zone is very poor on both Posix and Windows systems.
> > And Windows won't even let you set the time zone for your program
> > without setting for the whole OS. It's not a pleasant situation really,
> > but I hope to be able to overcome it well enough that D programmers
> > won't have to worry about it.
>
> I had the "pleasure" to work with time zones on Windows once, what a mess!
>
> On OSX, Cocoa has an API for that, but you can probably get it the posix
> way too.
I wasn't aware that there was an API. I either need to use the API (at which
point, I'd end up with a MacOSXTimeZone in addition to PosixTimeZone and
WindowsTimeZone), or I need to know where the time zone files are in Mac OS X. As
I understand it, Mac OS X does use the same time zone files as Linux, but I don't
know where it keeps them. Linux uses /usr/share/zoneinfo, but I have no idea if
Mac OS X even has /usr, let along /usr/share/zoneinfo. Unfortunately, I have no
access to either a Mac or a machine with FreeBSD, so some of the OS-specific stuff
in my code may need some work (though PosixTimeZone would likely be the main
culprit).
- Jonathan M Davis
More information about the phobos
mailing list