Just been scratching my head over a code snippet that looks like this:
struct tm *timeinfo=localtime(&now);
struct tm *tick_timeinfo=localtime(&last_tick);
else return BAD;
I'd realized this was code was always returning OK, even when last_tick was yesterday, a month ago, or even from last year.
Can you see the bug? The above is all you need to know. Answers in a comment. No stamp required.
(To be fair to my bruised ego, the problem can really only be one thing in the way I've presented it above.)
Kudos to the first reply. And I'd be interested to hear how people do date comparisons in C++ more safely.