Created
August 24, 2023 08:19
-
-
Save Akira-Hayasaka/fb17825e4692f319e48b8ec2d23cdf79 to your computer and use it in GitHub Desktop.
compare before 1970/01/01 epoch std::tm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static bool comp_dates_before_1970_epoch(const std::tm& dt1, const std::tm& dt2) | |
{ | |
if (dt1.tm_year != dt2.tm_year) return dt1.tm_year < dt2.tm_year; | |
if (dt1.tm_mon != dt2.tm_mon) return dt1.tm_mon < dt2.tm_mon; | |
if (dt1.tm_mday != dt2.tm_mday) return dt1.tm_mday < dt2.tm_mday; | |
if (dt1.tm_hour != dt2.tm_hour) return dt1.tm_hour < dt2.tm_hour; | |
if (dt1.tm_min != dt2.tm_min) return dt1.tm_min < dt2.tm_min; | |
return dt1.tm_sec < dt2.tm_sec; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment