
On Monday 01 June 2009 19:55:04 Stewart, Robert wrote:
The initial problem was that the default handling of the %H format specifier (passing it to strftime) played badly with time durations that could be longer than 24 hours. The resolution was to provide additional %O format specifier that does not have 24 hour restriction.
I suspect that's not common -- other than for the OP, perhaps.
You think so? I don't know how often it is needed to operate longer durations, but IMHO, objectively there is no such restriction for time durations and the library should not artificially impose one.
Jeff's explanation in the associated list message implies that, too.
What message do you mean?
However the original poster proposes to change the default format of time durations from %H:%M:%S%F to %O:%M:%S%F so that formatted durations are always allowed to be longer than 24 hours. I mostly agree with this change, however it is clearly a breaking change that can affect error checking in some cases.
Changing the default will create surprises in some cases. I'd prefer to see error checking -- an exception when the valid %H range is violated. That would alert library users to the problem when violated and the exception message could even suggest the need for %O (as should the docs, of course).
That would provide useful behavior for those violating the range unknowingly and it would avoid breaking compatibility and, reasonable expectations for users.
The change mostly affects formatting. There already is an assert, so users will know if %H is used improperly. The assert is present since 1.38. The question is whether the change to %O as a default is justified enough and how it should be announced better.