Testing DST Patches
From Brandonhutchinson.com
You've applied DST patches. How do you test the changes without actually changing the system date?
Note: I can't think of any reason not to trust zdump output, and there may be a better procedure for doing this.
The following example Solaris 8 system using time zone Australia/NSW has received the latest DST patches for Australia.
$ zdump -v Australia/NSW | grep 2008 Australia/NSW Fri Mar 28 19:22:17 2008 UTC = Sat Mar 29 06:22:17 2008 EST isdst=1 Australia/NSW Sat Mar 29 15:59:59 2008 UTC = Sun Mar 30 02:59:59 2008 EST isdst=1 Australia/NSW Sat Mar 29 16:00:00 2008 UTC = Sun Mar 30 02:00:00 2008 EST isdst=0 Australia/NSW Sat Oct 25 15:59:59 2008 UTC = Sun Oct 26 01:59:59 2008 EST isdst=0 Australia/NSW Sat Oct 25 16:00:00 2008 UTC = Sun Oct 26 03:00:00 2008 EST isdst=1
The following Perl script will show what happens at 2008/03/30 02:59:59 and one second after as well as 2008/10/26 01:59:59 and one second after.
#!/usr/bin/perl
use POSIX qw(strftime);
use Time::Local;
$time = timegm(59,59,15,29,2,108);
print "strftime gives: ", strftime("%A %C", localtime($time)), "\n";
print "strftime gives: ", strftime("%A %C", localtime($time+1)), "\n";
$time = timegm(59,59,15,25,9,108);
print "strftime gives: ", strftime("%A %C", localtime($time)), "\n";
print "strftime gives: ", strftime("%A %C", localtime($time+1)), "\n";
$ ./show_DST.pl strftime gives: Sunday Sun Mar 30 02:59:59 EST 2008 strftime gives: Sunday Sun Mar 30 02:00:00 EST 2008 strftime gives: Sunday Sun Oct 26 01:59:59 EST 2008 strftime gives: Sunday Sun Oct 26 03:00:00 EST 2008
This makes sense given the output of zdump above.
After patching the system, the time zone data for Australia/NSW is correct:
$ zdump -v Australia/NSW | grep 2008 Australia/NSW Fri Mar 28 19:26:10 2008 UTC = Sat Mar 29 06:26:10 2008 EST isdst=1 Australia/NSW Sat Apr 5 15:59:59 2008 UTC = Sun Apr 6 02:59:59 2008 EST isdst=1 Australia/NSW Sat Apr 5 16:00:00 2008 UTC = Sun Apr 6 02:00:00 2008 EST isdst=0 Australia/NSW Sat Oct 4 15:59:59 2008 UTC = Sun Oct 5 01:59:59 2008 EST isdst=0 Australia/NSW Sat Oct 4 16:00:00 2008 UTC = Sun Oct 5 03:00:00 2008 EST isdst=1
The following Perl script will show what happens at 2008/04/06 02:59:59 and one second after as well as 2008/10/05 01:59:59 and one second after.
#!/usr/bin/perl
use POSIX qw(strftime);
use Time::Local;
$time = timegm(59,59,15,5,3,108);
print "strftime gives: ", strftime("%A %C", localtime($time)), "\n";
print "strftime gives: ", strftime("%A %C", localtime($time+1)), "\n";
$time = timegm(59,59,15,4,9,108);
print "strftime gives: ", strftime("%A %C", localtime($time)), "\n";
print "strftime gives: ", strftime("%A %C", localtime($time+1)), "\n";
$ ./show_DST.pl strftime gives: Sunday Sun Apr 6 02:59:59 EST 2008 strftime gives: Sunday Sun Apr 6 02:00:00 EST 2008 strftime gives: Sunday Sun Oct 5 01:59:59 EST 2008 strftime gives: Sunday Sun Oct 5 03:00:00 EST 2008
Again, this makes sense given the output of zdump above.
