Difference Between Two Dates in C – mktime() and difftime()
Computing the difference between two dates in C is a classic exercise that most tutorials get subtly wrong — hand-rolled day counting that forgets the century leap-year rules, so 1900 counts as a leap year when it wasn’t. The C standard library already solved this: convert each date to a time_t with mktime(), subtract with …