How to get the current Timezone

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 28 16:02:59 PDT 2015


On Friday, August 28, 2015 18:04:16 Adam D. Ruppe via Digitalmars-d-learn wrote:
> On Friday, 28 August 2015 at 17:59:06 UTC, WhatMeWorry wrote:
> > Stupid question. If it always returns an empty string, why is
> > it even there?
>
> It can return meaningful information in other subclasses; it is a
> method from the interface and is just blank in the LocalTime
> class.
>
> If you construct one of the other subclasses, you may provide a
> name which can be retrieved through it, or perhaps some future
> class might implement it too.

A prime example would be PosixTimeZone. It knows exactly what its name is.
Ultimately though, the name field probably isn't very useful - particularly
since I really need to deprecate the functions for converting between the TZ
database names and Microsft's names, because it's system dependent, and they
keep changing it, so there's no guarantee that the mapping is correct or
even that the result exists on a given box (since that box could be
out-of-date, or the D program may not have been updated). That being the
case, the name property really just becomes applicable to PosixTimeZone.

I _really_ wish that Microsoft would just use the TZ database like everyone
else...

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list