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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -