The Nano time is not a 'real' time, it is just a counter that increments starting from some unspecified number when some unspecified event occurs (maybe the computer is booted up).
It will overflow, and become negative at some point. If your t0
is just before it overflows (i.e. very large positive), and your t1
is just after (very large negative number), then t1 < t0
(i.e. your conditions are wrong because t1
happened after t0
).....
But, if you say t1 - t0 < 0
, well, the magic is that a for the same overflow (undeflow) reasons (very large negative subtract a very large positive will underflow), the result will be the number of nanoseconds that t1 was after t0
..... and will be right.
In this case, two wrongs really do make a right!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…