On Dec 14, 2019, at 9:16 PM, Robert Elz <kre@munnari.OZ.AU> wrote:
For time_t what I mean is that it should not survive as it is, we need (just for "seconds" time counters) two entirely different things, which keep track of the different ways we count time, differently. Currently this is fudged with how one obtains the time_t (CLOCK_MONOTONIC, CLOCK_REALTIME etc) but because they all produce the same type (time_t) they can all be processed the same way - so a CLOCK_MONOTONIC result can be handed to localtime() which makes no rational sense at all.
For the purposes of logging events as they happen (meaning that, assuming the clock isn't incorrectly set ahead, all time stamps quickly become time stamps in the past), a value that 1) is a count of seconds (and perhaps fractional seconds) that have elapsed since some defined epoch, including leap seconds, and 2) can be converted to YYYY-MM-DD HH:MM:SS.SSSS is useful. That way, 1) you can easily calculate time deltas between those events and 2) you can find out when a particular event happened. (Some may already have guessed that I'm thinking of, among other things, network traffic captures here.)