[Po4a-commits] "po4a/lib/Locale/Po4a Po.pm,1.91,1.92"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Mon Jul 14 19:42:04 UTC 2008


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv21737/lib/Locale/Po4a

Modified Files:
	Po.pm 
Log Message:
	* lib/Locale/Po4a/Po.pm: Fix timezone() so it works on Solaris
	(replace strftime("%s", at t) with Time::Local::timelocal(@t)).


Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- Po.pm	2 Apr 2008 20:19:07 -0000	1.91
+++ Po.pm	14 Jul 2008 19:42:01 -0000	1.92
@@ -88,6 +88,7 @@
 use File::Path; # mkdir before write
 use File::Copy; # move
 use POSIX qw(strftime floor);
+use Time::Local;
 
 use Encode;
 
@@ -123,16 +124,16 @@
 }
 
 # Return the numerical timezone (e.g. +0200)
-# The %z format of strftime is not portable.
-# For example, it indicates "2006-10-25 19:36E. Europe Standard Time" on
-# MS Windows.
+# Neither the %z nor the %s formats of strftime are portable:
+# '%s' is not supported on Solaris and '%z' indicates
+# "2006-10-25 19:36E. Europe Standard Time" on MS Windows.
 sub timezone {
     my @g = gmtime();
     my @l = localtime();
 
     my $diff;
-    $diff  = floor(strftime("%s", at l)/60 +0.5);
-    $diff -= floor(strftime("%s", at g)/60 +0.5);
+    $diff  = floor(timelocal(@l)/60 +0.5);
+    $diff -= floor(timelocal(@g)/60 +0.5);
 
     my $h = floor($diff / 60) + $l[8]; # $l[8] indicates if we are currently
                                        # in a daylight saving time zone




More information about the Po4a-commits mailing list