4 ms·
The danger comes when you need to compare your timestamps to something that may have happened before your system initialized. If you can both guarantee your tim
by zamadatix 3y ago
The danger comes when you need to compare your timestamps to something that may have happened before your system initialized. If you can both guarantee your time type will only ever be used for timestamps on your system and these will never in the future interact with or be compared to timestamps from prior to your system going online then you can get away with an epoch at the start of your system.
The Unix epoch was never an issue being 1970 because they knew they were making it as signed, not because they thought Unix systems would never deal with e.g. files from before Unix was created.
- evanelias 3y agoAgain, unsigned ints weren't even present in C until 1978, so of course it was signed -- there was no alternative. As far as I've ever read, negative unix timestamp values generally were not used. Since -1 was used as an error value, you cannot safely determine whether that value represents an error vs a legitimate timestamp one second before the epoch. I'm not familiar with if/how early versions of Unix were able to interact with non-Unix files/filesystems, but I doubt they would preserve metadata such as mtime if so.