Robert Elz said:
| But if strftime doesn't restrict the ranges of the various struct | tm fields to their "normal" values, it makes me wonder how much | latitude a push-the-boundaries programmer actually has when | calling strftime. Are the values as unlimited as they are when | calling, say, mktime?
What POSIX says is:
If any of the specified values are outside the normal range, the characters stored are unspecified.
which means that if you provide a value for tm_hour outside the 0..23 range, what happens is anyone's guess (and you cannot complain.)
Not quite. There's an important difference between "unspecified" and "undefined". In this case, the resulting string could be anything but it must still be a string and the call can't break anything else. If it had been "undefined", then the call - or even the *existence* of the call in your code - can cause the program to behave in any way the implementation likes, including - for example - wiping or corrupting the entire filesystem. -- Clive D.W. Feather | If you lie to the compiler, Email: clive@davros.org | it will get its revenge. Web: http://www.davros.org | - Henry Spencer Mobile: +44 7973 377646