Bug 29461 - strptime() failed to parse negative %s number of seconds since the Epoch, happily produced by strftime()
Summary: strptime() failed to parse negative %s number of seconds since the Epoch, hap...
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: time (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-08 19:29 UTC by Yann Droneaud
Modified: 2022-08-08 19:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
strftime(), strptime() %s format test with negative timestamp (373 bytes, text/x-csrc)
2022-08-08 19:29 UTC, Yann Droneaud
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Droneaud 2022-08-08 19:29:40 UTC
Created attachment 14267 [details]
strftime(), strptime() %s format test with negative timestamp

strftime(,"%s",) can produce negative number of seconds since the Epoch for date before the 1970-01-01, but strptime() refuses to parse negative numbers, thus is unable to parse the string formatted by strftime().

For example, the attached test case reports the following:

    strftime() produced "-3600"
    strptime() failed to parse "-3600"