Bug 17208 - strptime, "%OS" and "."
Summary: strptime, "%OS" and "."
Alias: None
Product: R
Classification: Unclassified
Component: Language (show other bugs)
Version: R 3.3.*
Hardware: Other Linux
: P5 enhancement
Assignee: R-core
Depends on:
Reported: 2017-01-12 21:44 UTC by Frederick Eaton
Modified: 2017-01-12 21:44 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Frederick Eaton 2017-01-12 21:44:05 UTC
Recall that the "%OS" conversion accepts fractional seconds:

> strptime("17_35_14.01234.mp3","%H_%M_%OS.mp3")$sec
[1] 14.01234

Unfortunately for my application it seems to be "greedy", in that it tries to parse a decimal point which might belong to the rest of the format:

> strptime("17_35_14.mp3","%H_%M_%OS.mp3")
[1] NA

If I use "_" instead of ".", then it works:

> strptime("17_35_14_mp3","%H_%M_%OS_mp3")
[1] "2017-01-10 17:35:14 PST"

It would be nice if the code for R's "strptime" could avoid parsing the "." into the "%OS" specifier if it is not followed by a number.