Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/Date/Parse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ sub {
($year,$month,$day,$hh,$mm,$ss,$frac) = ($1,$3-1,$4,$5,$7,$8,$9);
}

# default C++ boost timestamp is effectively %Y-%b-%d %H:%M:%S.%f
# details: https://svn.boost.org/trac/boost/ticket/8839
if ($dtstr =~ s/\s(\d{4})([-:]?)(\w{3,})\2(\d\d?)(?:[-Tt ](\d\d?)(?:([-:]?)(\d\d?)(?:\6(\d\d?)(?:[.,](\d+))?)?)?)?(?=\D)/ /) {
($year,$month,$day,$hh,$mm,$ss,$frac) = ($1,$month{$3},$4,$5,$7,$8,$9);
}

unless (defined $hh) {
if ($dtstr =~ s#[:\s](\d\d?):(\d\d?)(:(\d\d?)(?:\.\d+)?)?(z)?\s*(?:([ap])\.?m?\.?)?\s# #o) {
($hh,$mm,$ss) = ($1,$2,$4);
Expand Down
2 changes: 2 additions & 0 deletions t/date.t
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ Jul 22 10:00:00 UTC 2002
2002-07-22 10:00Z
2002-07-22 10:00 +100
2002-07-22 10:00 +0100
2002-Jul-22 10:00:00.000000
2002-July-22 10:00:00.000000
!;

@data = split(/\n/, $data);
Expand Down