Hello,

i added support for "decimal fraction of a
second" in DateTime::Format::W3CDTF (as described in
http://www.w3.org/TR/NOTE-datetime)

Please note: There is already a bug report and a patch in ticket #14179
http://rt.cpan.org/Public/Bug/Display.html?id=14179

But this patch looked a bit too invasive for me.

I would be glad if could pull this patch into the mainstream package.

Please also note: I'm not subscribed to this mailing list, so you have to
anwser me directly.

Best regards,

Julian

--- DateTime/Format/W3CDTF.pm.orig	2007-11-06 21:15:12.000000000 +0100
+++ DateTime/Format/W3CDTF.pm	2007-11-06 21:35:17.000000000 +0100
@@ -66,6 +66,13 @@
         $p{time_zone} = 'floating';
     }
 
+    #check for decimal fraction
+    if ($date =~ s/\.(\d+)$// )
+    {
+	my $fraction = $1;
+	$p{'nanosecond'} = (1 / $fraction) * 10**9;
+    }
+
     my $format = $valid_formats{ length $date }
         or die "Invalid W3CDTF datetime string ($original)";
 

Reply via email to