extern variable tzname is not set correctly for Australia/Sydney timezone

Bug #1078087 reported by bd_at_jollyroger
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tzdata (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I compile and run the following C program on a machine whose default timezone is "America/New_York":

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdint.h>
#include <assert.h>

void printTimezone(void) {
  printf("Timezone is now '%s/%s', %ld seconds West of UTC\n",
  tzname[0], tzname[1], timezone);
}

int main(const int argc, const char *argv[]) {
  tzset();
  printTimezone();
  setenv("TZ", "Asia/Hong_Kong", 1);
  tzset();
  printTimezone();
  setenv("TZ", "Europe/London", 1);
  tzset();
  printTimezone();
  setenv("TZ", "Australia/Sydney", 1);
  tzset();
  printTimezone();
}

The resulting output is:

Timezone is now 'EST/EDT', 18000 seconds West of UTC
Timezone is now 'HKT/HKST', -28800 seconds West of UTC
Timezone is now 'GMT/BST', 0 seconds West of UTC
Timezone is now 'EST/EST', -36000 seconds West of UTC

As can be seen from the last line of the output, the values of tzname[0] and tzname[1] are incorrect for Australia/Sydney (seem to be set similarly to America/New_York) even though the value of timezone (i.e. seconds West of UTC) appears to be correct.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: tzdata 2012e-0ubuntu0.10.04
ProcVersionSignature: Ubuntu 2.6.32-45.99-generic 2.6.32.60+drm33.26
Uname: Linux 2.6.32-45-generic x86_64
Architecture: amd64
Date: Mon Nov 12 16:18:45 2012
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.1)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: tzdata

Revision history for this message
bd_at_jollyroger (brian8702) wrote :
Revision history for this message
Adam Conrad (adconrad) wrote :

Define "incorrect" here. I assume Sydney wasn't on daylight time when you checked, so the output above looks correct. Unless you were expecting "AEST" instead of "EST"? (Note that both forms are "correct", depending on who you ask, where they live, and how much they enjoy ambiguity).

Revision history for this message
bd_at_jollyroger (brian8702) wrote :

Sorry for the slow follow up, I didn't notice the comment hit my inbox and forgot about this until it reared its head again. Perhaps 'inconvenient' is a better description than incorrect, but users dealing with multiple time zones are being confused between Australia and US when they see the abbreviations on timestamps; the amount of display space allocated to this is limited, which is why abbreviations are being used, but I would expect AEST/AEDT instead of EST/EDT as per:
    http://en.wikipedia.org/wiki/Time_in_Australia
and
    http://www.timeanddate.com/library/abbreviations/timezones/au/

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in tzdata (Ubuntu):
status: New → Confirmed
Revision history for this message
Jon Reeve (themightyjon) wrote :

This is a really infuriating behaviour - just wasted half an hour figuring out why a bunch of timestamps I just "fixed" are all incorrectly set to -0500 rather than +1100, and then had to re-fix them all again. Apparently it's been discussed upstream and they're OK with the ambiguity (despite the fact that it needn't be). Ambiguity is one thing, but this outright breaks certain behaviour, like feeding the output of the date command into other things. If multiple timezones can be called EST then specifying EST as an input without some disambiguation should not be valid.

Anyway, this is kind of beyond the control of the Ubuntu guys I suspect, and thankfully this one sane and wonderful guy has a fix to the tzdata that he's maintaining. He's Australian, so this matters to him, as it does to me while I'm over here. Here's your workaround:

http://tedp.id.au/tzdata-au/

Or if you just want the commands:

wget -O- http://tedp.id.au/~ted/ddd11d8a.asc | sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/tzdata-au-ubuntu.list http://tedp.id.au/tzdata-au/sources.list.d/tzdata-au-ubuntu.list
sudo apt-get update && sudo apt-get install tzdata-au

Revision history for this message
Adam Conrad (adconrad) wrote :

Upstream tzdata has switched from ambiguous Australian timezone names to prepending "A", closing this bug.

Changed in tzdata (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.