time_to_epoch tm_mon ternary operator does not allow January dates to be converted to an epoch timestamp

Description

There's a ternary operator used in the time_to_epoch function that sets tdays to 0 if the value in tm_mon of the time struct is 0. 0 happens to be used for January. Thus, if you try to convert a string of a date in January to an epoch timestamp, the resulting time_t value will be invalid. This tm_mon check should be removed and any parts of the codebase that rely on 0 implying "not set" instead of January should be fixed.

Environment

None

Activity

Show:
Former user
December 27, 2013, 1:00 AM

Fix available in Pull Request #43.

Former user
December 27, 2013, 1:00 AM

I hope to get some time to add a unit test for this scenario.

David Dight
December 27, 2013, 4:44 AM

Nice find Evan. Thanks

Assignee

Former user

Reporter

Former user

Labels

None

Branch

master

Products

None

Time tracking

1h

Components

Fix versions

Affects versions

Due date

2013/12/26

Priority

Major
Configure