c - Compare 2 struct tm on multiplatform -
lets have 2
struct tm
i need compare them in linux, in linux kernel , in windows. best way make cross-platform check?
by "compare" mean finding out date bigger. example - date @ moment , compare date of account expired.
you convert them mktime
time_t
, calculate difference difftime
:
time_t t1 = mktime(tm1); time_t t2 = mktime(tm2); double diffsecs = difftime(t1, t2); // if positive, tm2 > tm1
Comments
Post a Comment