changeset 280:c6cc5979109b

Byron Clark - Support non-GMT timezones.
author Steve Kemp <steve@steve.org.uk>
date Mon, 06 Oct 2008 23:49:36 +0100
parents e4d05c7d6557
children c60b7c5184cd
files AUTHORS bin/chronicle
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Mon Sep 01 20:38:56 2008 +0100
+++ b/AUTHORS	Mon Oct 06 23:49:36 2008 +0100
@@ -11,6 +11,9 @@
 
   Listed alphabetically by surname.
 
+  Byron Clark [byron [at] name.theclarkfamily.name]
+   - Support non-GMT timezones
+
   Josh Grams [josh [@] com.qualdan]
    - Added better base URL detection.
    - Added chronological sorting for months & shorter month-URLs.
--- a/bin/chronicle	Mon Sep 01 20:38:56 2008 +0100
+++ b/bin/chronicle	Mon Oct 06 23:49:36 2008 +0100
@@ -1644,7 +1644,8 @@
     #  Get the Hours::Mins::Seconds from the Date: pseudo-header
     #
     my $time = str2time($date);
-    my $hms = time2str( "%H:%M:%S", $time );
+    my $hms  = time2str( "%H:%M:%S", $time );
+    my $tz   = time2str( "%z", $time );
 
 
     #
@@ -1664,6 +1665,7 @@
 
 
         $hms = time2str( "%H:%M:%S", $mtime );
+        $tz = "GMT";
     }
 
 
@@ -1676,14 +1678,16 @@
         #
         #  RSS 2
         #
-        $entry{ 'pubdate' } = time2str( "%a, %e %b %Y $hms GMT", $time );
+        $entry{ 'pubdate' } = time2str( "%a, %e %b %Y $hms $tz", $time );
         $entry{ 'pubdate' } =~ s/  +/ /g;
 
         #
         # Store the W3C date form
         # http://www.w3.org/TR/NOTE-datetime
         #
-        $entry{ 'w3cdate' } = time2str( "%Y-%m-%dT${hms}+00:00", $time );
+        my $w3ctz = $tz;
+        $w3ctz =~ s/([-+]\d\d)(\d\d)/$1:$2/;
+        $entry{ 'w3cdate' } = time2str( "%Y-%m-%dT${hms}$w3ctz", $time );
 
     }
     else