hoodwink.d enhanced
 

juretta.com

New Zealand Daylight Saving Time Change: Mac OS X and Java | October 05, 2007-->

October 05, 2007
It appears that Apple missed the new rules for Daylight Saving Time (DST) in New Zealand in even the most recent versions of Mac OS X 10.4 Tiger.
From this year [2007], Daylight Saving will run for a period of 27 weeks. It now commences from the last Sunday in September, when 2.00am becomes 3.00am, and ends on the first Sunday in April the following year, when 3.00am becomes 2.00am.

Mac OS X still thinks that the Daylight Saving time starts on Oct. 7th.

The knowledgebase entry is rather disappointing

Deselect (uncheck) 'Set Date & Time automatically' if it's enabled.
Manually set the correct time.

A better approach is to update the timezone database that is used to compute the correct time for your timezone in relation to UTC (Read more):
GMT_TIME + LOCAL_TIME_ZONE_OFFSET + DST_OFFSET.

First check if you have to update the timezone information (assuming you have selected NZST/NZDT as your local timezone):

macbook-pro:~ stefan$ zdump -v /etc/localtime | grep 2007
/etc/localtime Sat Mar 17 13:59:59 2007 UTC = Sun Mar 18 02:59:59 2007 NZDT isdst=1 
/etc/localtime Sat Mar 17 14:00:00 2007 UTC = Sun Mar 18 02:00:00 2007 NZST isdst=0 
/etc/localtime Sat Oct 6 13:59:59 2007 UTC = Sun Oct 7 01:59:59 2007 NZST isdst=0 
/etc/localtime Sat Oct 6 14:00:00 2007 UTC = Sun Oct 7 03:00:00 2007 NZDT isdst=1

This shows that the Mac thinks that the daylight saving time (NZDT) will start on Sun Oct 7. That's wrong.

To update the Mac OS X timezone database download the latest tzdata2007_.tar.gz from ftp://elsie.nci.nih.gov/pub/. As of Oct 1 it's ftp://elsie.nci.nih.gov/pub/tzdata2007h.tar.gz

macbook-pro:~ stefan$ curl -O ftp://elsie.nci.nih.gov/pub/tzdata2007h.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  158k  100  158k    0     0   4851      0  0:00:33  0:00:33 --:--:--  7928
Extract the archive and run the zic timezone compiler
macbook-pro:~ stefan$ mkdir tzdata; tar -xvzf tzdata2007h.tar.gz -C tzdata
macbook-pro:~ stefan$ cd tzdata; sudo zic australasia

You might want to reboot the system to enable the new timezone information.

Check again:
macbook-pro:~ stefan$ zdump -v /etc/localtime | grep 2007
/etc/localtime  Sat Mar 17 13:59:59 2007 UTC = Sun Mar 18 02:59:59 2007 NZDT isdst=1
/etc/localtime  Sat Mar 17 14:00:00 2007 UTC = Sun Mar 18 02:00:00 2007 NZST isdst=0
/etc/localtime  Sat Sep 29 13:59:59 2007 UTC = Sun Sep 30 01:59:59 2007 NZST isdst=0
/etc/localtime  Sat Sep 29 14:00:00 2007 UTC = Sun Sep 30 03:00:00 2007 NZDT isdst=1
Java Update

The JRE uses it's one timezone database (unfortunately). We need to update this information as well.

Got to http://java.sun.com/javase/downloads/index.jsp and get the JDK DST Timezone Update Tool - 1.2.2.

Expand the archive and run the tzupdater.jar: sudo java -Djava.vendor="Sun Microsystems Inc." -jar tzupdater.jar -v -u

macbook-pro:~ stefan$ sudo java -Djava.vendor="Sun Microsystems Inc." -jar tzupdater.jar -v -u 
Password:
java.home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
java.vendor: Sun Microsystems Inc.
java.version: 1.6.0-dp
JRE time zone data version: tzdata2006a
Embedded time zone data version: tzdata2007g
Extracting files... done.
Renaming directories... done.
Validating the new time zone data... done.
Time zone data update is complete.
Quick check:
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("Pacific/Auckland"));
cal.setTimeInMillis(new Date().getTime());	
System.out.format("%1$tT (%1$tB %1$td %1$tY)", cal, new Locale("de", "DE"));
@02:18 | Comments: 1 | Tags: Java (11), Mac (18)

Diggman

Related Entries


1
foxcamel says:
Avatar Tue Jan 29 07:48:59 +0100 2008 | #

very usefull,thanks,i linked it on my blog ispig:hobix

Add a New Comment

About

juretta.com is the personal workspace of Stefan Saasen. You can send him an email or read more about this site in the „About“ section.

« Previous entry

javap
posted 9 months ago

» Next entry

URI-Template gem released
posted 4 months ago

Related Entries

Recent comment

On: “New Zealand Daylight Saving Time Change: Mac OS X and Java

very usefull,thanks,i linked it on my blog ispig:hobix

posted 5 months ago by foxcamel

Look!

Latest links  RSS  

More...