Chapter 18. Timezone in Bering-uClibc

Revision History
Revision 0.12003-08-17espakman
Initial version
Revision History
Revision 0.22005-02-25espakman
Some improvements by Kory Krofft
Revision History
Revision 0.32005-02-27kp
add J. Nilo's findings

Table of Contents

Setting the timezone
Examples for TZ values
Specification of the TZ variable

Setting the timezone

In Bering-uClibc /etc/timezone and the whole zoneinfo directory tree are not supported. To set the timezone, edit /etc/TZ file and set the timezone in a single line, ending with a newline, as specified in


Be shure to have no empty line at the end /etc/TZ - in that case your timezone will be set to back UTC.

For example: CST6CDT means Central Standard Time which is 6 hours earlier than Coordinated Universal Time (UTC) and that standard rules for adjustment to Daylight Savings Time are to be applied. The first letters preceding the offset are actually nothing more than the descriptor used by programs such as "date" when displaying the time. Use whatever letters are meaningful in your area. The offset number is what is used to actually calculate the difference from UTC. The last three letters again can be anything that represents a meaningful adjustment to the offset given. A "tongue in cheek" example:


is "legal" and might refer to Martian Canal Time which is defined as being 6 hours later than Coordinated Universal Time (UTC) and modified by one hour to Canal Savings Time on the standard date.

Examples for TZ values

To give you an idea how to build your local TZ value, a few more examples provided by Erik Anderson:


This means that MDT (Mountain Daylight Time) is 6 hours earlier than Coordinated Universal Time (UTC) and does not have daylight saving time.


This means that Japanese Standard Time (JST) is 9 hours earlier than Coordinated Universal Time (UTC) and does not have daylight saving time.


This means that Mountain Standard Time (MST) is 7 hours earlier than Coordinated Universal Time (UTC). Both standard time and daylight saving time apply to this locale. By default Mountain Daylight Time (MDT) is one hour ahead of MST. Since it isn't otherwise specified, daylight saving time starts on the first Sunday of April at 2:00 A.M. and ends on the last Sunday of October at 2:00 A.M.


This means that Newfoundland Standard Time (NST) is 3.5 hours earlier than Coordinated Universal Time (UTC). Both standard time and daylight saving time apply to this locale. Newfoundland Daylight Time is 1.5 hours earlier than Coordinated Universal Time (UTC).


This example has been sent by Jacques Nilo and provides a complete expample for MET, METDST (summer time) and the date and daytime it will be changed.

Specification of the TZ variable

This section is an extract from SUSv3 specification and the technical background how a TZ value is builded.

The value of TZ is of the form:

std offset dst offset, rule

The format is as follows:



  • std and dst: Indicate no less than three, nor more than {TZNAME_MAX}, bytes that are the designation for the standard ( std) or the alternative ( dst -such as Daylight Savings Time) timezone. Only std is required; if dst is missing, then the alternative time does not apply in this locale.

  • offset: Indicates the value added to the local time to arrive at Coordinated Universal Time. The offset has the form: hh[:mm[:ss]]

    The minutes ( mm) and seconds ( ss) are optional. The hour ( hh) shall be required and may be a single digit. The offset following std shall be required. If no offset follows dst, the alternative time is assumed to be one hour ahead of standard time. One or more digits may be used; the value is always interpreted as a decimal number. The hour shall be between zero and 24, and the minutes (and seconds)-if present-between zero and 59. The result of using values outside of this range is unspecified. If preceded by a '-' , the timezone shall be east of the Prime Meridian; otherwise, it shall be west (which may be indicated by an optional preceding '+' ).

  • rule: Indicates when to change to and back from the alternative time. The rule has the form: date[/time],date[/time]

    where the first date describes when the change from standard to alternative time occurs and the second date describes when the change back happens. Each time field describes when, in current local time, the change to the other time is made.

    The format of date is one of the following:

    • Jn: The Julian day n (1 <= n <= 365). Leap days shall not be counted. That is, in all years-including leap years-February 28 is day 59 and March 1 is day 60. It is impossible to refer explicitly to the occasional February 29.

    • n: The zero-based Julian day (0 <= n <= 365). Leap days shall be counted, and it is possible to refer to February 29.

    • Mm.n.d: The d'th day (0 <= d <= 6) of week n of month m of the year (1 <= n <= 5, 1 <= m <= 12, where week 5 means "the last d day in month m" which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occurs. Day zero is Sunday. The time has the same format as offset except that no leading sign ( '-' or '+' ) is allowed. The default, if time is not given, shall be 02:00:00.