0068611b4d
Now we manage a timezone and daylight-savings aware version of localtime. We parse UNIX timezone strings. The default (active after the first call to localtime or localtime_r) is CET/CEST, the timezone of Europe/Vienna. The wallclock-time osd-example demonstrates how to set a different timezone via the timezone resource. Note: After startup no timezone is set. So in this state querying the timezone resource will return an empty string. After first call to localtime (if not timezone has been set via the timezone resource) a query to timezone will return the default timezone string for CET/CEST. The string returned by the localtime and utc timezones now also includes the timezone name. New fields tm_gmtoff and tm_zone were added to the tm structure. These are available in BSD systems and when setting special compiler definitions on Linux. Note: the timezone offset information in the tm structure (tm_gmtoff) as well as in the tz structure returned by gettimeofday (tz_minuteswest) may be wrong sign, this code is largely untested.
21 lines
868 B
Plaintext
21 lines
868 B
Plaintext
Timezones
|
|
=========
|
|
|
|
The new version supports time zones and daylight saving time (DST).
|
|
Currently we support only a single timezone. We use the UNIX timezone
|
|
format which is usually specified in an environment variable TZ.
|
|
|
|
Note that for timezone information you can have different
|
|
representation, either relative to Universal Time Coordinated (UTC) or
|
|
to International Atomic Time (TAI), the latter contains leap seconds.
|
|
Since most systems today use UTC *and* the clock of a microcontroller
|
|
is typically not accurate enough to care about leap seconds, we're using
|
|
timezone files relative to UTC.
|
|
|
|
Wikipedia has a very good treatment of the public timezone database in
|
|
https://en.wikipedia.org/wiki/Tz_database
|
|
|
|
The format of timezone strings is described in the Linux manual page
|
|
tzset(3). The timezone specification for Europe/Vienna is
|
|
CET-1CEST,M3.5.0,M10.5.0/3
|