Hello Chen,

as we've seen already, the timezone detection is a very heuristic problem.
It makes it extremely complicated and unreliable, if a system is not providing correct, incomplete or even wrong information. If you only get the names, you need an internal table to get the start and end time of DST anyway. Unfortunately not all Linux/Unix systems provide much more than tzset(), so this is also not a general solution using a daylight variable.

We could think about a compile switch for linux systems which can provide more information. Our MacOSX/iPhoneOS implementations are basing also on other functions than tzset() for time zone detection.

Regards,
Beat

Hello,
On linux (platform_adapters/linux/platform_timezones.cpp),
the implementation of getSystemTimeZoneContext seems have
problems: it use tzset() and later check tzname[0], tzname[1]
to match against a built-in known timezone table (sysync/tz_table.h).

I found the tzname fields set by tzset() is incorrect or at least ambiguous
on ubuntu karmic, fedora 11.
In my case, my system timezone is Asia/Shanghai (UTC+8), but synthesis engine will
detect is as UTC-6.
My conclusion is we cannot use tzname fields to detect the timezone, maybe we can
try use timezone and daylight variable instead?
------------------------------
See below tests:
The samle code is as below:
tzset()
printf ("tzname[0] %s\n", tzname[0]);
printf ("tzname[1] %s\n", tzname[1]);

---
Here are the output on Ubuntu karmic:
TZ=':Asia/Shanghai' ./test
tzname 0 CST
tzname 1 CDT

TZ=':America/Chicago' ./test
tzname 0 CST
tzname 1 CDT

TZ=':Asia/Tokyo' ./test
tzname 0 JST
tzname 1 JDT


Best Regards,
Congwu



_______________________________________________
os-libsynthesis mailing list
[email protected]
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis


--
-----------------------------------------------
       Beat FORSTER
       Dipl. El. Ing. ETH
       Dipl. NDS ETHZ in Betriebswissenschaften
       Managing Partner
       [email protected]

Synthesis AG   SyncML Server & Client Solutions
Badenerstrasse 18,  CH-8004 Zürich, Switzerland
Tel (direct):       +41 44 440 66 02
Fax:                +41 44 440 66 04
email:              [email protected]
web:          http://www.synthesis.ch
-----------------------------------------------

_______________________________________________
os-libsynthesis mailing list
[email protected]
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis

Reply via email to