2 ms·
> I found a google groups pseudo-newsgroup comp.os.vms discussion dated 2017 Saw that too in my googling, fair warning that several commenters on there seem mi
by asveikau 7y ago
> I found a google groups pseudo-newsgroup comp.os.vms discussion dated 2017
Saw that too in my googling, fair warning that several commenters on there seem misinformed. (The code sample at the start is incorrect and some comment rebuttals seem to misunderstand or get it partially correct. In particular some people seem to think time_t is a struct with int components or that sizeof(int) has something to do with time_t.)
> Pretty sure the posted article is wrong about 63-bit because at the intro it clearly says, "All Versions" yet here we see that as of 8.3 it was still 32-bit.
The point is that the kernel doesn't keep the time as time_t. It has a different epoch and unit, and the C runtime needs to convert it to time_t. So the fact that 63 bits (64 if you count signed bit) is used internally says nothing about time_t at the libc layer.
Windows has it similarly. There, the epoch is 1/1/1601 and the unit is 100ns, stored as 64 bits.
- jiveturkey 7y ago> The point is that the kernel doesn't keep the time as time_t. Does the kernel (linux or VMS) care about absolute calendar time at all? time_t is a strictly userspace construct is it not?
- asveikau 7y agoShort answer is yes it does. One example where the kernel needs to care is that the filesystem maintains the last write time on files. I am sure there are many others. And if not having the kernel store a time somewhere, where must it come from? Userspace cannot fabricate it from nothing. Even if the kernel used some "relative" thing, where does the base offset come from? However you answer that, keep in mind all processes have to agree, writing it needs to be privileged, it might need to read and write a hardware clock, etc., all problems storing it in the kernel solves. Also keep in mind that time_t is not a "calendar" construct, it is an integer, and it's not time zone specific. User mode can and does build calendars and time zones on top.