[Rt-commit] r8357 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT

ternus at bestpractical.com ternus at bestpractical.com
Wed Aug 1 13:04:28 EDT 2007


Author: ternus
Date: Wed Aug  1 13:04:26 2007
New Revision: 8357

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Date.pm

Log:
Using POSIX::tzset to fix timezone environment variable caching bug.


Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Date.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Date.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Date.pm	Wed Aug  1 13:04:26 2007
@@ -68,6 +68,7 @@
 package RT::Date;
 
 use Time::Local;
+use POSIX qw(tzset);
 
 use strict;
 use warnings;
@@ -778,6 +779,9 @@
         @local = gmtime($unix);
     } else {
         local $ENV{'TZ'} = $tz;
+	## Using POSIX::tzset fixes a bug where the TZ environment variable
+	## is cached.
+	POSIX::tzset();
         @local = localtime($unix);
     }
     $local[5] += 1900; # change year to 4+ digits format
@@ -814,6 +818,9 @@
             return Time::Local::timegm(@_[0..5]);
         } else {
             local $ENV{'TZ'} = $tz;
+	    ## Using POSIX::tzset fixes a bug where the TZ environment variable
+	    ## is cached.
+	    POSIX::tzset();
             return Time::Local::timelocal(@_[0..5]);
         }
     }


More information about the Rt-commit mailing list