Why do TTime comparisons give unexpected results?
问题 I have observed some kind of weird behaviour regarding the EncodeDateTime and EncodeTime methods and I am seeking some explanation. procedure SomeTestCase; var time: TTime; dateTime: TDateTime; begin time := EncodeTime(8, 0, 0, 0); date := EncodeDateTime(2012, 11, 2, 8, 0, 0, 0); Assert(time = TimeOf(date)); //Fails end; What I've found is that date 's hour portion evaluates to 7:59:59 instead of 8:00:00 . But if I set the hour portion of time and date to 9, the assert passes and date