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!
February 15th, 2006 at 9:34 PM
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
February 16th, 2006 at 6:11 AM
Thanks!
December 28th, 2008 at 3:34 AM
[...] quanto riguarda la data, occorre specificare il corretto timezone nel file /etc/TZ come spiegato in questo [...]
October 19th, 2009 at 1:16 AM
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.