[Interest] Getting the timezone from Qt?

Konrad Rosenbaum konrad at silmor.de
Tue Jul 31 09:18:56 CEST 2012


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.


	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120731/64f33b86/attachment.sig>


More information about the Interest mailing list