Time Zone - Day Light Savings

Our system has an option to supply your timezone in area of world you want to keep time for user transactions and such.

It keeps time zone for user in database as for example -5 for EST.

The problem is we are in EDT -4 (daylight savings time) so the time is displayed wrong.

We can put the time in the system in a standard UNIXTIMESTAMP format but when we convert with most perl functions like time2str it does not take into account daylight savings time.

Does anybody know a solution or point me in right direction. We use linux and perl, but any programming language will do.

tks

For my solution see: Understanding Unix Timekeeping

If you don't like my solution and decide to ask for another, tell us what OS you are using.

DateTime module did the job very well.

Here is an example.

#! /usr/bin/perl
use Time::Local;

($s,$min,$h,$d,$m,$y,$dst) = (localtime)[0,1,2,3,4,5,8];
$m +=1;
$y += 1900;

########################################
use DateTime;

$dt = DateTime->new(
			year => $y,
			month => $m,
			day => $d,
			hour => $h,
			minute => $min,
			second => $s,
			nanosecond => 500000000,
			time_zone => 'America/New_York',
		);
$dt->set_time_zone('UTC');
print $dt->datetime; 
print $dt->time_zone_short_name;
print "\n";
$dt->set_time_zone('America/New_York');
print $dt->datetime;
print $dt->time_zone_short_name;
print "\n";
$dt->set_time_zone('America/Chicago');
print $dt->datetime;
print $dt->time_zone_short_name;
print "\n";

The output is:

2007-08-27T23:18:50UTC
2007-08-27T19:18:50EDT
2007-08-27T18:18:50CDT