ler224 has asked for the wisdom of the Perl Monks concerning the following question:
while(<>){ chomp; $line = $_; my @line = split(';',$line); $line[4] =~ s/:/\//; ($month) = $line[4] =~ m/(\d+)\/\d+/; ($day) = $line[4] =~ m/\d+\/(\d+)/; $hour = (int($line[7]/3600000)) % 24; $minute = sprintf '%02d', (int($line[7]/60000)) % 60; $second = sprintf '%02d', (int($line[7]/1000)) % 60; $ms = sprintf '%03d', $line[7] % 1000; $formatter = new DateTime::Format::Strptime( pattern => '%Y-%m-%d %H:%M:%S.%3N'); $dhms = DateTime->new(year => $line[5], month => $month, day => $day, hour => $hour, minute => $minute, second => $second, nanosecond => $ms * 1000000, time_zone => 'Etc/UTC', formatter => $formatter, ); $dhms = $dhms->clone->set_time_zone('America/New_York'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateTime speed improvement - suggestion
by tobyink (Canon) on Apr 09, 2014 at 13:44 UTC | |
|
Re: DateTime speed improvement - suggestion
by Laurent_R (Canon) on Apr 09, 2014 at 17:34 UTC |