There are a lot of old DOS-centric file formats, especially file archiving and compression formats, which store timestamps of files.
Most of them use the standard MS-DOS timestamp format for such things. This format is usually interpreted as two 16-bit integers: one for the date, and one for the time of day. I’m not sure, but I think the format comes from the “FAT” filesystem format.
Using DOS’s usual byte order for encoding integers (“little-endian” order), we can interpret these fields at the byte level, like so:
The question of the moment is, when stored in a file, which field comes first: the date, or the time?
Putting the date first seems to me to be the most natural order. It feels right to encounter the most significant data first.
But there are some reasons to put the time first:
- Because that’s how the FAT format does it.
- For easier sorting, when interpreted as a single 32-bit little-endian integer.
There are also situations where you can be agnostic about it, because your software development kit has a 4-byte date type corresponding to this format. So, you can just write it to the file without really knowing what’s going on inside it. An example from the relevant time period might be Turbo Pascal’s
Another way to decide is to do whatever some other format does, either deliberately, or because you used some of the same source code.
What should have been the correct answer is, of course, neither. You should use a better timestamp format instead. This biggest problem with this one is that it has only 5 bits for the seconds field, which is only enough for a 2-second resolution. But that’s beside the point. This format was used, a lot.
I surveyed some arbitrarily-selected formats, mainly those for which I had this information readily available. The results are below.
Please note: Some of these formats were later extended to support better timestamps. A format’s presence on this list does not imply that it is still unable to handle odd-numbered seconds.
- ARC (SEA)
- CAB (Microsoft)
- CP Shrink
- InstallShield Z
- The Stirling Compressor
- ZSQ (Chin/Kumar)
- ARI/ERI (RAO Inc.)
- CRUSH (PocketWare)
- Quantum (Cinematronics)
As I was doing this survey, starting with the generally better known and older formats, it was looking like the two factions were about equally popular. But when I got to newer and more obscure formats, I found that they almost all used time-first order. Since there are a large number of these newer-and-more-obscure formats, I suspect that if I were to keep going, giving each format one vote regardless of popularity, time-first would win by a considerable margin.