Mail Archives: cygwin/2004/03/08/12:53:04
On Fri, Mar 05, 2004 at 10:53:12AM -0600, "DePriest, Jason R." wrote:
> I actually implemented the following so that my script will still work
> correctly after whatever whatever is fixed.
>
> I am in the Central Time Zone, so you'd have to adjust the number of
> seconds you add or remove accordingly.
>
> [code]
> use Time::Local;
> print "GM: " . gmtime() . "\n";
> print "Local: " . localtime() . "\n";
> if (gmtime() eq localtime()) {
> print "GM time and localtime are the same!\n";
> print "I'll have to make some adjustments.\n";
> if ($isdst) {
> $time = time() - 18000;
> } # end of if it is daylight savings time
> else {
> $time = time() - 21600;
> } # end of else it is standard time
> $adjtime = gmtime($time);
> print "Adjusted: $adjtime\n";
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> gmtime($time);
> $mon += 1;
> $year += 1900;
> } # end of if local time is calculated as gm time
> else {
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime;
> $mon += 1;
> $year += 1900;
> } # end of else the local time is correct
> [/code]
Just putting a:
use POSIX 'tzset'; tzset();
at the beginning of your script will work around the problem.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -