The test team submitted a Defect on ClearQuest that caused my attention. When the input date in a logic is 1940, it will produce an exception. The program logic is not normal. Intuitive tells me, this is likely to use it. When the time is compared, it is wrong. If it is not possible, it is found after carefully positioning:
When tracking here, I found that the calculated DIFF is actually a negative value!
Check the document carefully and find that my Boost Date_Time library sees the TIME_DURATION TICKS data type to __INT64 at this time, and the data overflow has occurred :)
65 * 365 * 24 * 60 * 60 * 1000000000
Boost :: POSIX_TIME :: Time_Duration Diff = Util :: PTIME_NOW () - Util :: Oletime_to_boosttime (DateOfbirth); IF (Diff.is_NEGATIVE () || DIFF> Boost :: POSIX_TIME :: Hours (200 * 365 * 24))) Return E_INVALIDARG;
Change it to Date_Duration, there is no problem.
Boost :: Gregorian :: DATE_DURATION DIFF = Boost :: Gregorian :: DAY_CLOCK :: Local_Day () - Util :: OLEDATE_TO_BOOSTDATE (DATEOFBIRTH);
IF (Diff.is_NEGATIVE () || DIFF> Boost :: Gregorian :: DATE_DURATION (200 * 365)) Return E_INVALIDARG;}