Greg Wooledge (12023-12-20): > Huh? None of this makes any sense. I salute you for your patience and excellent message.
Just a few remarks: > Learn how time works. Then rewrite everything. Fortunately, we do not have to handle relativistic issues à la “meanwhile at the other side of the galaxy”… > Any piece of software that wants to calculate durations needs to work > with epoch times, or something equivalent to epoch times. A small nitpick here NOT RELEVANT TO THE CURRENT DISCUSSION but important if wannabe developers learn things reading you. This is true for long durations, not short durations, with the difference between the two being: is the system allowed to reboot in the middle? If the system might reboot between the beginning and the end, then you are absolutely right, the “wall clock” of Unix systems is the right choice. But if the system cannot reboot unless it makes the duration irrelevant (think: timeout for a network connection), then the right choice is not the wall clock but the monotonic clock. See: https://pubs.opengroup.org/onlinepubs/000095399/functions/clock_gettime.html (For shell, the monotinic time is in /proc/uptime) > So, to be completely blunt here, what you want to do is store ALL > timestamps in epoch time format. This could be a string like > "1703082118", or it could be the raw 64-bit integer which this string > represents. Either way's fine, depending on your programming language > and tool set. A format that can be reliably converted with a rather simple algorithm over the contemporary era, like the ISO time syntax, would be acceptable too. Last: a long time ago, I wrote this for French Usenet (and it somehow found its way on this website; I should publish it on my own): https://www.generation-nt.com/reponses/la-gestion-de-l-heure-sous-linux-entraide-500251.html I think it might be of interest, and nowadays LLMs can translate it correctly I guess. Regards, -- Nicolas George