Re:What every programmer should know about time
by cbr on Monday July 04, 2011 @07:50AM
(#2726252)
Really? What if it wraps around? ts1=MAX_INT-40, ts2=20, ts2-ts1 < 0. Or does that actually work out correctly with signed integers in C?
[ Parent
| on HN ]
Re:What every programmer should know about time
by wnoise on Monday July 04, 2011 @04:41PM
(#2727806)
Technically, overflow of signed integers invokes undefined behavior (or possibly implementation defined. In my copy of a draft standard overflow is given as an example of undefined behavior, but 6.3.1.3 say implementation defined). In practice, it's the same bit values as unsigned integers, which does the right thing in this case.