Posted on 2001-08-09
COleDateTime d1(2001, 10, 10, 14, 0, 0);
COleDateTime d2(2001, 10, 10, 13, 0, 0);
COleDateTimeSpan res = d1 - d2;
COleDateTimeSpan oneHour(0, 1, 0, 0);
if (res != oneHour)
The above code causes an assertion. You would expect the value of "res" to be the same as "oneHour", the values returned by GetTotalSeconds() are exactly the same.
The assertion appears to be due to a difference between the values of the double that is used to store the COleDateTime value. This difference appears to be at the sub-second level but is significant because the comparison operators work directly with the double value.
I am using Visual Studio 6 with service pack 5.
Anyone got any fixes for this. Microsoft don't seem to have anything in their knowledgebase on this problem.