How to calculate time differences in C++ with time_t before the epoch?
问题 What I would like to do with my simple program is to calculate a difference in seconds between two dates. time_t referenceDate; time_t dateNow = time(0); struct tm referenceDateComponent = {0}; referenceDateComponent.tm_hour = 0; referenceDateComponent.tm_min = 0; referenceDateComponent.tm_sec = 0; referenceDateComponent.tm_year = 89; referenceDateComponent.tm_mon = 11; referenceDateComponent.tm_mday = 31; referenceDate = mktime(&referenceDateComponent); long seconds = difftime(dateNow,