OpenWRT and Time zone

February 14th, 2006

By default, an OpenWRT router operates in the UTC (Universal Time Coordinate) time zone.

OpenWRT stores the time zone inside a file named /etc/TZ. If this file is missing or empty, OpenWRT assumes the local time equals UTC time. The format is pretty strange, and has the following syntax:

syntax ::= GMT< 'offset>

offset ::= (+|-)

hour ::= [ 00 - 12 ]

The is the value you must add to or substract from the local time to get the UTC time. This offset will be positive if the local time zone is west of the Prime Meridian and negative if it is east. For example, TZ must be set to GMT-1 for Madrid, which is GMT+1:

# echo GMT-1 > /etc/TZ

UPDATED: The syntax for the TZ variable is documented here.

Following this document, the correct contents for file /etc/TZ when located in Madrid would be:

CET-1CEST-2,M3.5.0/2,M10.5.0/3

Thanks Kiko!

4 Responses to “OpenWRT and Time zone”

  1. Kiko Says:

    Actually,

    CET-1CEST-2,M3.5.0/2,M10.5.0/3

    would be more correct. See:

    http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html

  2. Felipe Alfaro Solana Says:

    Thanks! :-)

  3. metti il crontab alla caldaia Says:

    [...] quanto riguarda la data, occorre specificare il corretto timezone nel file /etc/TZ come spiegato in questo [...]

  4. Ximinez Says:

    It is worth noting that CET-1CEST-2,M3.5.0/2,M10.5.0/3 works for all EU-contries that use CET. The dates (M3.5.0/2,M10.5.0/3) have been the same for all EU countries (and Norway) since 1996.

Leave a Reply