[phobos] datetime review

Sean Kelly sean at invisibleduck.org
Sat Oct 9 07:43:07 PDT 2010


On Oct 8, 2010, at 10:47 PM, Jonathan M Davis wrote:

> On Friday 08 October 2010 22:30:02 Walter Bright wrote:
> 
>>> There are multiple time zone classes because it uses polymorphism to deal
>>> with the rules for a given time zone. The really basic LocalTime and UTC
>>> deal with most cases, but for anyone who really needs to deal with
>>> multiple time zones, PosixTimeZone and WindowsTimeZone will be
>>> invaluable (I'd love to only have one of those, but Windows just doesn't
>>> deal with time zones like the Posix world does).
>> 
>> I agree some kind of polymorphism for time zones is necessary. [rant]
>> Timezones should be an operating system service, if for no other reason
>> than it sucks to have all your apps break when some tinhorn country
>> decides to change their daylight savings time, etc.[/rant]
> 
> 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.

libicu does a decent job with timezones, but the library is immense.  I'd love to have this functionality in Phobos.


More information about the phobos mailing list