Please run a test for me (it takes only minutes)
In my post on Python and time zones I mentioned that I hadn’t tried this on Windows yet. But now I have, and I have painstakingly and with help from several Mac OS X users come up with something that may be a way of getting the time zone information reliably on both Linux, Mac OS X and Windows. But of course, I’m not sure.
So therefore, I’d like to ask you, dear reader, to make a quick test for me. Especially if you live in a strange timezone, or have an unusual os, or weird time zone setup, or anything else.
The steps are as follows (the svn line gets cut off, but you can still copy and paste it):
svn co http://www.plone4artists.org/svn/projects/Plone4ArtistsCalendar/tztest/trunk tztest cd tztest python tztest/__init__.py
Whatever the output is, paste it as a comment on this blog post. If you get an unexpected result, i.e. and error, or if the time zone printed is wrong, then *please* leave a correct email address when you fill in the comment.
Filed under: calendaring, plone, python, zope | Tagged: cross-platform, python, time zones

OK, I’ll start with my own Ubuntu computer:
OS: Linux cricket 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Paris’
[tztest 1.0] The time zone name is: Europe/Paris
And here is my Windows XP computers output.
OS:
Platform: win32
TZ: None
time.tzname: (’Romance Standard Time’, ‘Romance Daylight Time’
Time zone file: None
The time zone name is: Europe/Paris
And here is the output from a Mac OS X that DarthShrine on #python provided me with:
OS: Darwin SilverSpoon.local 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31 17:46:22 PDT 2007; root:xnu-1228.0.2~1/REL
EASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’EST’, ‘EST’
Time zone file: ‘/usr/share/zoneinfo/Australia/Canberra’
The time zone name is: Australia/Canberra
Note how happy the test output is. ‘
Nimbus:tztest matthewwilkes$ python tztest/__init__.py
OS: Darwin Nimbus.lan 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’GMT’, ‘BST’
Time zone file: ‘/usr/share/zoneinfo/Europe/London’
[tztest 1.0] The time zone name is: Europe/London
ajung@suxmac:~/src/tztest python tztest/__init__.py
OS: Darwin suxmac 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Berlin’
[tztest 1.0] The time zone name is: Europe/Berlin
OS: Darwin Alex.local 8.10.0 Darwin Kernel Version 8.10.0: Wed May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh powerpc
Platform: darwin
TZ: None
time.tzname: (’EET’, ‘EEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Athens’
[tztest 1.0] The time zone name is: Europe/Athens
On Leopard in the UK
OS: Darwin balrog.local 9.2.0 Darwin Kernel Version 9.2.0: Tue Feb 5 16:13:22 PST 2008; root:xnu-1228.3.13~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’GMT’, ‘BST’
Time zone file: ‘/usr/share/zoneinfo/Europe/London’
dhcp65:~/tztest matth$ python tztest/__init__.py
OS: Darwin dhcp65.bristol.offices.netsight.co.uk 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
time.tzname: (’GMT’, ‘BST’
Time zone file: ‘/usr/share/zoneinfo/Europe/London’
[tztest 1.0] The time zone name is: Europe/London
OS: Darwin alex-clarks-macbook-pro-15.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’EST’, ‘EDT’
Time zone file: ‘/usr/share/zoneinfo/US/Eastern’
[tztest 1.0] The time zone name is: US/Eastern
and here is OpenBSD, not really the latest version:
OS: OpenBSD kronos…….ch 4.0 GENERIC#3 macppc
Platform: openbsd4
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Zurich’
[tztest 1.0] The time zone name is: Europe/Zurich
OS: Darwin white-horse.corp.nlg1.com 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’BRT’, ‘BRST’
Time zone file: ‘/usr/share/zoneinfo/Brazil/East’
[tztest 1.0] The time zone name is: Brazil/East
pepper:tztest franklin$ python2.4 tztest/__init__.py
OS: Darwin pepper.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Amsterdam’
[tztest 1.0] The time zone name is: Europe/Amsterdam
OS: Darwin drystorm.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’EET’, ‘EEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Athens’
[tztest 1.0] The time zone name is: Europe/Athens
OS: Darwin hornet.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
time.tzname: (’GMT’, ‘BST’
Time zone file: ‘/usr/share/zoneinfo/Europe/London’
[tztest 1.0] The time zone name is: Europe/London
Worksforme
On a currently misconfigured Gentoo box:
OS: Linux frodo.fezconsulting.com 2.6.16.29-xen #1 SMP Sun Sep 30 04:00:13 UTC 2007 x86_64 Dual-Core AMD Opteron(tm) Processor 2212 HE AuthenticAMD GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’Local tim’, ‘Local tim’
Time zone file: ‘/etc/localtime’
[tztest 1.0] The time zone name is: Local tim
Who is Local Tim, I wonder?
OS: Linux margot 2.6.24-16-386 #1 Thu Apr 10 12:50:06 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/etc/localtime’
[tztest 1.0] The time zone name is: CEST
Works on Ubuntu Hardy too…
OS: Linux asus 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’BRT’, ‘BRST’
Time zone file: ‘/etc/localtime’
[tztest 1.0] The time zone name is: BRT
Correct.
~/tztest/tztest$ python2.4 __init__.py
OS: Linux prag 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/etc/localtime’
[tztest 1.0] The time zone name is: CEST
OS: Linux nyx 2.6.24-16-generic #1 SMP Thu Apr 10 12:47:45 UTC 2008 x86_64 GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/etc/localtime’
[tztest 1.0] The time zone name is: CEST
Hax0red by Local Tim!!! Call the police!
OS: Darwin whitebook.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’EET’, ‘EEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Helsinki’
[tztest 1.0] The time zone name is: Europe/Helsinki
OS: Linux blackrain 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/etc/localtime’
[tztest 1.0] The time zone name is: CEST
vismaya:/tmp/tztest pradeep$ python tztest/__init__.py
OS: Darwin vismaya.btbytes.com 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
Traceback (most recent call last):
File “tztest/__init__.py”, line 231, in
get_zone()
File “tztest/__init__.py”, line 224, in get_zone
print(”/etc/timezone: ” + tzname)
TypeError: cannot concatenate ’str’ and ‘NoneType’ objects
OS: FreeBSD 7.0-RELEASE FreeBSD 7.0-RELEASE #2: Sat Mar 29 02:01:50 WST 2008
Platform: freebsd7
TZ: None
/etc/timezone: None
time.tzname: WST/WST
Time zone file: ‘/usr/share/zoneinfo/Australia/Perth’
[tztest 1.1] The time zone name is: Australia/Perth
$python tztest/__init__.py
OS: Darwin ip-152010136201.its.appstate.edu 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: EST/EDT
Time zone file: ‘/usr/share/zoneinfo/US/Eastern’
[tztest 1.1] The time zone name is: US/Eastern
vismaya:/tmp/tztest pradeep$ python tztest/__init__.py
OS: Darwin vismaya.btbytes.com 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: EST/EDT
Time zone file: ‘/usr/share/zoneinfo/America/Detroit’
[tztest 1.1] The time zone name is: America/Detroit
On Windows XP in Québec (Time zone US Eastern)
C:\yvesm\Plone-collective\tztest>python tztest/__init__.py
Traceback (most recent call last):
File “tztest/__init__.py”, line 231, in ?
get_zone()
File “tztest/__init__.py”, line 164, in get_zone
tzname = windows_tz.tz_names[pytzname[0]]
KeyError: ‘Est’
OS: Linux gram 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘User defined’
time.tzname: CET/CEST
Time zone file: ‘/etc/localtime’
[tztest 1.1] The time zone name is: User defined
OS: Darwin tholia.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: CET/CEST
Time zone file: ‘/usr/share/zoneinfo/Europe/Amsterdam’
[tztest 1.1] The time zone name is: Europe/Amsterdam
(which is perfectly OK)
OS: Darwin Crow.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: CET/CEST
Time zone file: ‘/usr/share/zoneinfo/Europe/Berlin’
[tztest 1.1] The time zone name is: Europe/Berlin
OS: FreeBSD bee.xxvii.net 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 10:35:36 UTC 2008 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
Platform: freebsd7
TZ: None
/etc/timezone: None
time.tzname: EST:EDT
Time zone file: ‘/etc/localtime’
[tztest 1.2] The time zone name is: EDT
OS: Linux mustap 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘Europe/Copenhagen’
time.tzname: CET:CEST
Time zone file: ‘/etc/localtime’
[tztest 1.2] The time zone name is: Europe/Copenhagen
Here’s the output for OS X in Arizona - looks promising for us (very few people get the AZ time zone stuff right it seems):
MacPro:tztest steven$ python tztest/__init__.py
OS: Darwin MacPro.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: MST:MST
Time zone file: ‘/usr/share/zoneinfo/America/Phoenix’
[tztest 1.2] The time zone name is: America/Phoenix
OS: Linux newportaldev 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘America/Chicago’
time.tzname: CST:CDT
Time zone file: ‘/etc/localtime’
[tztest 1.2] The time zone name is: America/Chicago
This is Windows XP. It gets the timezone correct, but the OS info is wrong because it picks up ‘uname’ from the path and calls the cygwin utility (there is an installation of cygwin on the box).
OS: CYGWIN_NT-5.1 PACWKS01 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
Platform: win32
TZ: None
/etc/timezone: u’America/Chicago’
time.tzname: Central Standard Time:Central Standard Time
Time zone file: None
[tztest 1.2] The time zone name is: America/Chicago
C:\DOCUME~1\Sidnei\LOCALS~1\Temp\tztest>c:\Python24\python.exe tztest\__init__.p
y
Platform: win32
TZ: None
/etc/timezone: u’America/Sao_Paulo’
time.tzname: E. South America Standard Time:E. South America Daylight Time
Time zone file: None
[tztest 1.2] The time zone name is: America/Sao_Paulo
OS: Linux battle.localdomain 2.6.18-53.1.14.el5xen #1 SMP Wed Mar 5 12:39:19 EST 2008 i686 i686 i386 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: None
time.tzname: CET:CEST
Time zone file: ‘/etc/localtime’
[tztest 1.2] The time zone name is: CEST
OS: Darwin kai-lautaporttis-macbook-pro.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: EET:EEST
Time zone file: ‘/usr/share/zoneinfo/Europe/Helsinki’
[tztest 1.2] The time zone name is: Europe/Helsinki
$ python tztest/__init__.py
OS: Darwin TS42Loaner 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: PST:PDT
Time zone file: ‘/usr/share/zoneinfo/US/Pacific’
[tztest 2.0] The time zone name is: US/Pacific
OS: Darwin asterix.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: EST:EST
Time zone file: ‘/usr/share/zoneinfo/Australia/Hobart’
[tztest 2.0] The time zone name is: Australia/Hobart
After various bugfixes, the verison is now 2.5. People who have tested before are welcome to retest if they want to.
After various bugfixes, the verison is now 2.5. People who have tested before are welcome to retest if they want to.
trunk $ python tztest/__init__.py
OS: Darwin dumbo.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: EST:EDT
Time zone file: ‘/usr/share/zoneinfo/America/Indianapolis’
[tztest 2.5]
Timezone found by following the link from /etc/localtime
The time zone name is: America/Indianapolis
OS: Darwin jonathan-lewis-no-macbook-pro-15.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: JST:JST
Time zone file: ‘/usr/share/zoneinfo/Asia/Tokyo’
[tztest 2.5]
Timezone found by following the link from /etc/localtime
The time zone name is: Asia/Tokyo
OS: Linux notebook1 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘Asia/Calcutta’
time.tzname: IST:IST
Time zone file: ‘/usr/share/zoneinfo/Asia/Calcutta’
[tztest 2.5]
Timezone found in /etc/timezone
The time zone name is: Asia/Calcutta
Works great for me (on Mac OS 10.4) :
OS: Darwin gattaca 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: CET:CEST
Time zone file: ‘/usr/share/zoneinfo/Europe/Brussels’
[tztest 2.5]
Timezone found by following the link from /etc/localtime
The time zone name is: Europe/Brussels
OS: Linux luigicasa-laptop 2.6.24-17-generic #1 SMP Thu May 1 14:31:33 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘Europe/Rome’
time.tzname: CET:CEST
Time zone file: ‘/etc/localtime’
[tztest 2.5]
Timezone found in /etc/timezone
The time zone name is: Europe/Rome
[...] Please run a test for me (it takes only minutes) [...]
OS: Darwin michael.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: NZST:NZDT
Time zone file: ‘/usr/share/zoneinfo/Pacific/Auckland’
[tztest 2.6]
Timezone found by following the link from /etc/localtime
The time zone name is: Pacific/Auckland
OS: Darwin Macintosh-2.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
/etc/timezone: None
time.tzname: EST:EDT
Time zone file: ‘/usr/share/zoneinfo/America/New_York’
Aaron, you only forgot to to include the actual result.
(But it doens’t matter. It’s always worked on OS X, I’m sure it worked on your machine as well).
OS: Linux benji-laptop 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘America/New_York’
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
/etc/timezone: ‘America/New_York’
time.tzname: EST:EDT
Time zone file: ‘/etc/localtime’
[tztest 3.0]
Timezone found in /etc/timezone
The time zone name is: America/New_York
On Solaris in Sweden:
OS: SunOS unknown 5.10 Generic_127128-11 i86pc i386 i86pc
Platform: sunos5
TZ: ‘Europe/Stockholm’
/etc/timezone: None
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
/etc/timezone: None
time.tzname: CET:CEST
Time zone file: ‘/usr/share/lib/zoneinfo/Europe/Stockholm’
[tztest 3.0]
Timezone found by following the link from TZ or /etc/localtime
The time zone name is: Europe/Stockholm
Mac OS X 10.5.2 (Macbook Pro)
OS: Darwin crowley.zopatista.com 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar 4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Platform: darwin
TZ: None
time.tzname: (’CET’, ‘CEST’
Time zone file: ‘/usr/share/zoneinfo/Europe/Oslo’
[tztest 1.0] The time zone name is: Europe/Oslo
openSUSE 10.3, Budapest, Hungary results:
OS: Linux linux-x60 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC i686 i686 i386 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: None
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
/etc/timezone: None
time.tzname: CET:CEST
Time zone file: ‘/etc/localtime’
[tztest 3.1]
Timezone found by comparing /etc/localtime to zoneinfo files.
The time zone name is: Europe/Budapest
OS: Linux pc-62-103-239-201.cm.vtr.net 2.6.24.5-85.fc8 #1 SMP Sat Apr 19 12:39:34 EDT 2008 i686 i686 i386 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: None
/etc/conf.d/clock: None
/etc/sysconfig/clock: ‘America/Santiago’
/etc/timezone: None
time.tzname: CLT:CLST
Time zone file: ‘/etc/localtime’
[tztest 3.1]
Timezone found in /etc/sysconfig/clock
The time zone name is: America/Santiago
Ubuntu 8.04, and I am in US/Eastern
OS: Linux meeko 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: None
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
time.tzname: EST:EDT
Time zone file: ‘/etc/localtime’
[tztest 3.1]
No reliable timezone found. Using time.tzinfo.
The time zone name is: EDT
Wow. Ubuntu 8.04, and *None* of the techniques worked.
There is no /etc/timezone, although there should be, and for some reason /etc/localtime is not a copy of /usr/share/zoneinfo/US/Eastern, which it should be.
If it’s impossible even on Ubuntu 8.04 to figure out your correct timezone in a reliable manner I think it’s time to give up for me.
This isn’t going to work.
Ubuntu 8.04 geives me this:
OS: Linux bajor 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘User’
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
time.tzname: CET:CEST
Time zone file: ‘/etc/localtime’
[tztest 3.1]
No reliable timezone found. Using time.tzinfo.
The time zone name is: CEST
And for the record:
$ ls -al /etc/*time*
-rw-r–r– 1 root root 45 2008-05-09 17:19 /etc/adjtime
-rw-r–r– 1 root root 1074 2007-10-21 10:01 /etc/localtime
-rw-r–r– 1 root root 13 2008-03-30 13:51 /etc/timezone
$ cat /etc/timezone
User defined
$
After setting the timezone (hadn’t I done that already?):
$ ls -al /etc/timezone
-rw-r–r– 1 root root 45 2008-05-09 17:19 /etc/adjtime
lrwxrwxrwx 1 root root 36 2008-05-11 08:38 /etc/localtime -> /usr/share/zoneinfo/Europe/Amsterdam
-rw-r–r– 1 root root 17 2008-05-11 08:38 /etc/timezone
$ cat /etc/timezone
Europe/Amsterdam
$
Your script now does this:
OS: Linux bajor 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘Europe/Amsterdam’
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
time.tzname: CET:CEST
Time zone file: ‘/usr/share/zoneinfo/Europe/Amsterdam’
[tztest 3.1]
Timezone found by following the link from TZ or /etc/localtime
The time zone name is: Europe/Amsterdam
Hope this helps….
Whoops, forgot that I hadn’t upgraded that machine yet. It actually is running Ubuntu 7.10. Sorry about that.
Yep, me again. This time the results *are* from my Ubuntu 8.04 machine.
OS: Linux lead 2.6.24-16-generic #1 SMP Thu Apr 10 12:47:45 UTC 2008 x86_64 GNU/Linux
Platform: linux2
TZ: None
/etc/timezone: ‘Europe/Amsterdam’
/etc/conf.d/clock: None
/etc/sysconfig/clock: None
time.tzname: CET:CEST
Time zone file: ‘/etc/localtime’
[tztest 3.1]
Timezone found in /etc/timezone
The time zone name is: Europe/Amsterdam
$ ls -al /etc/*time*
-rw-r–r– 1 root root 46 2008-04-26 20:53 /etc/adjtime
-rw-r–r– 1 root root 2917 2008-04-25 22:56 /etc/localtime
-rw-r–r– 1 root root 17 2008-04-25 22:56 /etc/timezone
$ cat /etc/timezone
Europe/Amsterdam
$
So while /etc/localtime is not a symlink to /usr/share/…, the correct timezone is stored in /etc/timezone.
Well, you time zone was configured enough for /etc/localtime to contain CET/CEST. But somehow the time zone was not configured based on the zoneinfo data.
That this can happen, and evidently happens quite often, means that it’s going to be hard to get a reliable zoneinfo time zone from the Ubuntu configuration.
OS: Linux localhost.localdomain 2.6.23.1-42.fc8 #1 SMP
f8
Tue Oct 30 13:55:12 EDT 2007 i686 i686 i386 GNU/Linux
Platform: linux2
TZ: None
Config files: /etc/sysconfig/clock
time.tzname: MYT:MYT
Time zone file: ‘/etc/localtime’
[tztest 3.1]
Timezone found in /etc/sysconfig/clock
The time zone name is: Asia/Kuala_Lumpur
This is from an ec2 based lenny instance
OS: Linux len 2.6.16-xenU #1 SMP Mon May 28 03:41:49 SAST 2007 i686 GNU/Linux
Platform: linux2
TZ: None
Config files: /etc/timezone
time.tzname: UTC:UTC
Time zone file: ‘/etc/localtime’
[tztest 3.2]
Timezone found in /etc/timezone
The time zone name is: Etc/UTC
My time zone is IST (Ireland). This caused problems in zope2 which mixed it up with Israel or India.
Your result below GMT:IST looks much more useful
/tmp/tztest$ python tztest/__init__.py
OS: Linux kevinlaptop-ubuntu 2.6.15-29-386 #1 PREEMPT Mon Sep 24 17:18:25 UTC 2007 i686 GNU/Linux
Platform: linux2
TZ: None
Config files: /etc/timezone
time.tzname: GMT:IST
Time zone file: ‘/usr/share/zoneinfo/Europe/Dublin’
[tztest 3.2]
Timezone found by following the link from TZ or /etc/localtime
The time zone name is: Europe/Dublin