Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 89286
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: eli [...] siliconsprawl.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Default nginx time format is not parsed
Date: Sun, 6 Oct 2013 19:19:27 -0700
To: bug-Date-Manip [...] rt.cpan.org
From: Eli Lindsey <eli [...] siliconsprawl.com>
Nginx uses a somewhat quirky default date format in its logs: dd/Mon/yyyy:hh:mm:ss eg. 07/Oct/2013:00:31:34 +0000 The quirky bit is the colon between the date and time. ParseDate doesn't handle this, though it will parse properly if that colon is converted to a space. Time::ParseDate includes this as a special format; it'd be very useful if Date::Manip could also recognize it. http://search.cpan.org/~muir/Time-ParseDate-2013.0920/lib/Time/ParseDate.pm#Special_formats: Repro - [eli@flatline:~/]$ cat test.pl use Date::Manip; print $Date::Manip::VERSION . "\n"; # date with colon, isn't parsed print ParseDate("07/Oct/2013:00:31:34 +0000") . "\n"; # date with space instead of colon; is parsed print ParseDate("07/Oct/2013 00:31:34 +0000") . "\n"; [eli@flatline:~/]$ perl test.pl 6.41 2013100617:31:34
The OO interface has the parse_format method which is designed to handle special cases like this, but I see that I never added a wrapper in the functional interface. I've added the ParseDateFormat function, and it will be in version 6.42. If you need a copy between now and the next release (December), email me separately at sbeck@cpan.org and I'll get you a copy. Alternately, you can use the OO interface (which I consider much better than the functional interface) and use the parse_format method immediately.
Subject: Re: [rt.cpan.org #89286] Default nginx time format is not parsed
Date: Mon, 7 Oct 2013 13:14:00 -0700
To: bug-Date-Manip [...] rt.cpan.org
From: "Eli L." <eli [...] siliconsprawl.com>
I spent some more time looking around for this timestamp. Turns out it's actually very common: http://publib.boulder.ibm.com/tividd/td/ITWSA/ITWSA_info45/en_US/HTML/guide/c-logs.html#common https://httpd.apache.org/docs/trunk/logs.html#common http://en.wikipedia.org/wiki/Common_Log_Format Using format works, but would it be worth adding ':' as one of the potential delimiters between date and time fields? Seems like there _might_ be disambiguation concerns with the timestamp, similar to dates with '-' as a delimiter. On Mon, Oct 7, 2013 at 11:06 AM, Sullivan Beck via RT < bug-Date-Manip@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=89286 > > > The OO interface has the parse_format method which is designed to handle > special cases like this, but I see that I never added a wrapper in the > functional interface. > > I've added the ParseDateFormat function, and it will be in version 6.42. > If you need a copy between now and the next release (December), email me > separately at sbeck@cpan.org and I'll get you a copy. > > Alternately, you can use the OO interface (which I consider much better > than the functional interface) and use the parse_format method immediately. > >
I've added this specific format to the parsing. I have NOT made ':' a general purpose separator between date and time... it is heavily enough used that I don't want to overload it.