Fergus Henderson wrote:
> A minute is always 60 seconds... except when there is a leap second.
> So I think you need TimeDiffMinutes too. You might as well include
> all of them.
Yes you are right. You need TimeDiffMinutes. But you don't need
TimeDiffDays. The other error in my contribution I know about is that
adding days is not always trivial, thanks to leap seconds. For example
what is 100 days + (23:59:60 December 31st 1990)? I am still prepared to code
this but my code will not be absolutely correct. (I think the best
solution is to convert to a time_t value and back, in the hope that the
OS will deal with the extra second.) Ditto with daylight saving time,
which is rather more likely to be a problem in practice. But still this
is the best solution available with the current cruddy state of date
functions in C, and I think should work pretty well in practice.