8 ms·
I've had more traumatic code errors due to times than I care to admit. The bottom line: Learn from Unix. Store everything in epoch time (even if you're in Win
by Kirby 17y ago
I've had more traumatic code errors due to times than I care to admit.
The bottom line: Learn from Unix. Store everything in epoch time (even if you're in Windows.) Do all your math in that. Showing local time is for display _only_. You won't ever regret it. (Well, hardly ever.)
- whatusername 17y agoAnd retire before 2038.
- agazso 17y agoAnd retire before 2038 if you still define time_t as a 32 bit signed integer.
- sorbits 17y agoAgree, but still be aware of leap seconds. Probably you want to choose to ignore them (as “unix time” does), but know what that means.
- MartinCron 17y agoAnd don't store birthdays of anyone older (currently) than 39. I had a bug where I was enforcing epoch time for birthdates (Why? Long story) It worked when I (born in 1976) tested it, but it totally exploded when my more senior (in years) comrade tested it. Embarrassing, that one.