We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I use mktime to convert date and time into a time_t value and I see a behavior, which I didn't expect. When calling mktime with 29.02.2010, I would expect the function to return -1, but it returns a time_t value representing the 01.03.2010.
Is that the normal behavior?
It's normal that it normalizes the parameters.
From §7.23.2.3 of ISO/IEC 98:99:1999: "The original values of the tm_wday and tm_yday components of the structure are ignored, and the original values of the other components are not restricted to the ranges indicated above."
This is what a Linux system writes about mktime(): "If structure members are out-side their legal interval, they will be normalized (so that, e.g., 40 October is changed into 9 November)."
Many thanks for the fast feedback.