Skip Menu |
 

This queue is for tickets about the POSIX-strptime CPAN distribution.

Report information
The Basics
Id: 66519
Status: new
Priority: 0/
Queue: POSIX-strptime

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

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



Subject: Please provide strptime $str, $fmt, \@time
Download (untitled) / with headers
text/plain 1000b
The original C API for strptime passes in a (mutable) struct tm_time, for strptime(3) to modify. It doesn't touch fields that aren't set by the format string. This lets you easily parse time and date from two different strings using two different formats. It would be useful to put this in POSIX::strptime too; so we could my @time; strptime $datestamp, '%Y-%m-%d', \@time; strptime $timestamp, '%H:%M:%S', \@time; As it is currently, merging two separate lists is slightly more awkward my @time = ( strptime $timestamp '%H:%M:%S' )[0,1,2], ( strptime $datestamp, '%Y-%m-%d' )[3,4,5]; It also currently leads to embarrassing bugs: say strftime '%b', strptime "Feb", '%b' => Jan This comes from the fact that strptime yielded a bunch of undefs in all the other positions (OK), which strftime treats as 0; normalising 0th Feb into 31st Jan. Nicer would be if we could my @t = (0,0,0,1,0,0); strptime "Feb", '%b', \@t; say strftime '%b', @t => Feb -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.