Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL Script to find the Daylight saving and change GMT to CST or CDT

Status
Not open for further replies.

muskan28

IS-IT--Management
Jun 10, 2004
1
US
Hi I was looking for a script how to find from the localtime of my os (Unix) that wether the daylight saving is on or off and on the basis of same conver the GMT to CST or CDT.
I have done the same in perl which is
my $sec;
my $min;
my $hour;
my $mday;
my $mon;
my $year;
my $wday;
my $yday;
my $isdst;

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();


if ($isdst=0)
{
print("no\n");
$date = &Date_ConvTZ($date,"GMT","CST");
print $date;
}
else
{print("yes\n");
$date = &Date_ConvTZ($date,"GMT","CDT");
print $date;
}


but i want the same code in TCL.

Thanks In Advance
Neeraj Lal
 
Not sure what your after.
I get my system time (local):
% set systemDT [clock format [clock seconds] -format "%D %T %Z"]
06/11/04 09:07:22 Mountain Daylight Time

I get GMT:
% set systemDT [clock format [clock seconds] -format "%D %T %Z" -gmt true]
06/11/04 15:09:41 GMT

To get some other zone, I think you need to know the GMT offset:
% set systemDT [clock format [expr [clock seconds]-6*3600] -format "%D %T"]
06/11/04 03:16:49

Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top