Author serhiy.storchaka
Recipients belopolsky, serhiy.storchaka, torm
Date 2014-12-30.18:45:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1419965117.01.0.704804987935.issue23134@psf.upfronthosting.co.za>
In-reply-to
Content
In C the strptime function doesn't return valid data if an input is invalid.

$ ./strptimetest "0 2015 1" "%W %Y %w"
2015-00--2 00:00:00
$ ./strptimetest "0 2015 2" "%W %Y %w"
2015-00--1 00:00:00
$ ./strptimetest "0 2015 3" "%W %Y %w"
2015-00-00 00:00:00
$ ./strptimetest "0 2015 4" "%W %Y %w"
2015-01-01 00:00:00
$ ./strptimetest "0 2015 5" "%W %Y %w"
2015-01-02 00:00:00
$ ./strptimetest "0 2015 6" "%W %Y %w"
2015-01-03 00:00:00
$ ./strptimetest "0 2015 7" "%W %Y %w"
2015-01-00 00:00:00

So this behavior likely is not a bug and doesn't need to be fixed in maintained releases. But it would be good to make strptime() more consistant and either extend it to support week and weekday numbers out of current valid range, or raise an exception.
History
Date User Action Args
2014-12-30 18:45:17serhiy.storchakasetrecipients: + serhiy.storchaka, belopolsky, torm
2014-12-30 18:45:17serhiy.storchakasetmessageid: <1419965117.01.0.704804987935.issue23134@psf.upfronthosting.co.za>
2014-12-30 18:45:16serhiy.storchakalinkissue23134 messages
2014-12-30 18:45:16serhiy.storchakacreate