in reply to time difference calculation
You can do this with the builtin module Time::Piece:
#!/usr/bin/env perl -l use strict; use warnings; use Time::Piece; my $start = '2013-10-28T18:59:52.863Z'; my ($whole, $ms) = $start =~ /([^.]+)(.*)Z$/; my $t1 = Time::Piece->strptime($whole => '%Y-%m-%dT%H:%M:%S'); my $t2 = gmtime; my $diff = $t2 - $t1; print 'Whole seconds diff: ', $diff; print 'Fractional seconds diff: ', $diff - $ms;
Output (which is correct for my timezone):
Whole seconds diff: 46979 Fractional seconds diff: 46978.137
My UTC date/time:
$ date -u Tue 29 Oct 2013 08:02:51 UTC
Confirmation calculation:
$ perl -E 'say(5*60*60 + 8 + 8*60*60 + 2*60 + 51)' 46979
-- Ken
|
|---|