[Interest] Getting the timezone from Qt?

Nikos Chantziaras realnc at gmail.com
Tue Jul 31 15:25:05 CEST 2012

On 31/07/12 10:18, Konrad Rosenbaum wrote:
> On Tuesday 31 July 2012 07:02:22 Nikos Chantziaras wrote:
>> On 31/07/12 06:43, Lorn Potter wrote:
>>> On 31/07/2012, at 1:28 PM, Nikos Chantziaras wrote:
>>>> I wonder if it's possible to deduce the timezone from the system's UTC
>>>> offset?  The offset can be determined through gmtime() and localtime(),
>>>> both in C89 so nothing platform-specific here:
>>> If it were that easy, we wouldn't need the extensive tz database. :)
>> Indeed.  That was quite a naive question, since several timezones most
>> probably have the same offset, so you can't use the offset as an index
>> into the tz database.
> I did a quick count on my copy of tzdata: 542 zone files, not including the
> simple offsets (582 total).
> But you gave me a nice idea: those offsets could be used as a fall-back in
> case auto-detection fails miserably. Thanks.

Hm, I think that DST messes up the idea.  There's no way to tell if the 
offset has DST in it or not.  So it's +3:00 here, but my time zone is 
actually +2:00, but since it's summer, an additional +1:00 is added.

More information about the Interest mailing list