3 ms·
You should never store or work with dates as unix epoch-based timestamps. Use proper date/time datatypes, and manipulate them with library functions. Naive inte
by ams6110 10y ago
You should never store or work with dates as unix epoch-based timestamps. Use proper date/time datatypes, and manipulate them with library functions. Naive integer arithmetic on unix timestamps will bite you in the ass a hundred different ways.
- tyingq 10y agoCertainly a good idea, but sometimes it's difficult to tell if OS functions and 3rd party libraries you depend on are doing that. The ext4 filesystem in Linux, for example, uses epoch time. I think they have it all fixed now, but there were bugs still out there as recently as this year: https://bugzilla.kernel.org/show_bug.cgi?id=23732 https://bugzilla.kernel.org/show_bug.cgi?id=23732
- jdub 10y ago> Use proper date/time datatypes, and manipulate them with library functions. The point is: What do they do? There are plenty that will use... Unix timestamps (or worse). Or use those as the lowest common denominator for interchange. There are more systems at play than the data layer, and all of them will take every opportunity to bite you in the arse.