Skip to content

Please run a test for me (it takes only minutes)

May 9, 2008

I don’t need more testing of this. Thanks to everyone who help me out with this! Great to see so many helpful people! Read my conclusion!

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.

73 Comments
  1. 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

  2. Lennart Regebro permalink

    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

  3. 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

  4. Note how happy the test output is. ‘)

  5. Matthew Wilkes permalink

    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

  6. ajung permalink

    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

  7. 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

  8. 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’

  9. 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

  10. 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

  11. 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

  12. LaSombra permalink

    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

  13. 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

  14. 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

  15. 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🙂

  16. 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?

  17. 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

  18. 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

  19. 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

  20. 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

  21. Hax0red by Local Tim!!! Call the police!

  22. 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

  23. 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

  24. 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

  25. Julian Coyne permalink

    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

  26. $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

  27. 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

  28. Yves Moisan permalink

    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’

  29. peter permalink

    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

  30. 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)

  31. Florian Schulze permalink

    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

  32. 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

  33. Mustapha Benali permalink

    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

  34. 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

  35. Michael Dudzik permalink

    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

  36. Michael Dudzik permalink

    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

  37. 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

  38. Jörgen Modin permalink

    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

  39. Kai Lautaportti permalink

    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

  40. $ 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

  41. 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

  42. After various bugfixes, the verison is now 2.5. People who have tested before are welcome to retest if they want to.

  43. After various bugfixes, the verison is now 2.5. People who have tested before are welcome to retest if they want to.

  44. Shashi permalink

    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

  45. 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

  46. 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

  47. 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

  48. luigi scarso permalink

    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

  49. Michael permalink

    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

  50. Aaron VanDerlip permalink

    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’

  51. 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).

  52. 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

  53. Claus Conrad permalink

    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

  54. Martijn Pieters permalink

    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

  55. Zeno Farkas permalink

    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

  56. 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

  57. Wade Leftwich permalink

    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

  58. 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.

  59. Mark van Lent permalink

    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….

  60. Mark van Lent permalink

    Whoops, forgot that I hadn’t upgraded that machine yet. It actually is running Ubuntu 7.10. Sorry about that.

  61. Mark van Lent permalink

    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.

  62. 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.

  63. 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

  64. 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

  65. 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

  66. Dominique permalink

    OS: Darwin dominique 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
    Config files:
    time.tzname: CET:CEST
    Time zone file: ‘/usr/share/zoneinfo/Europe/Vienna’

    [tztest 3.2]
    Timezone found by following the link from TZ or /etc/localtime
    The time zone name is: Europe/Vienna

  67. OS: Darwin tony.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
    Config files:
    time.tzname: ICT:ICT
    Time zone file: ‘/usr/share/zoneinfo/Asia/Bangkok’

    [tztest 3.2]
    Timezone found by following the link from TZ or /etc/localtime
    The time zone name is: Asia/Bangkok

  68. OS: Linux hal9000.sc.maricopa.edu 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
    Config files: /etc/sysconfig/clock
    time.tzname: MST:MST
    Time zone file: ‘/etc/localtime’

    [tztest 3.2]
    Timezone found in /etc/sysconfig/clock
    The time zone name is: America/Phoenix

  69. charlie h0tel permalink

    ch@gato:~/src/tztest$ cat /etc/issue
    Ubuntu 8.04.1 \n \l

    ch@gato:~/src/tztest$ python tztest/__init__.py
    OS: Linux gato 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008 i686 GNU/Linux
    Platform: linux2
    TZ: None
    Config files:
    time.tzname: PST:PDT
    Time zone file: ‘/etc/localtime’

    [tztest 3.2]
    No reliable timezone found. Using time.tzinfo.
    The time zone name is: PDT
    ch@gato:~/src/tztest$

  70. George permalink

    OS: Linux numpty 2.6.25.10-47.fc8 #1 SMP Mon Jul 7 18:39:51 EDT 2008 i686 i686 i386 GNU/Linux
    Platform: linux2
    TZ: None
    Config files: /etc/timezone:/etc/sysconfig/clock
    time.tzname: EST:EST
    Time zone file: ‘/etc/localtime’

    [tztest 3.2]
    Timezone found in /etc/sysconfig/clock
    The time zone name is: Australia/Sydney

  71. Testing is finished, so I have disallowed comments. Thanks everyone!

Trackbacks & Pingbacks

  1. Python and time zones part 2: The beast returns! « Lennart Regebro: Plone consulting
  2. Thanks for the testing help + conclusions. « Lennart Regebro: Plone consulting

Comments are closed.

%d bloggers like this: