How to determine if there is a stopwatch when using tm structure?

According to this struct tm

documentation, the value tm_sec

can be 0 - 61

, and the extra range should include leap seconds of some systems. How can I tell if there is a stopwatch in the system at all and on my openSUSE 13.2 machine?


source to share

1 answer

Seconds are not system specific. It is even a non-informational problem, but rather a physical one.

In an ideal world, where all clocks were perfectly accurate, there would be no reason for seconds to jump. But in our limited world, clocks tend to drift.

Moving the system time, especially moving it backwards, can cause bad things to happen. If a batch task saves the time of its last run to see what files have already been processed, and because the clock is moving backwards, it thinks the time before it was last run, it will process the file again, which could be simple.

For this reason, the system designers have invented leap seconds that allow the system to adjust its system clock (of course, only small deltas, but usually enough if you are checking the clock on a regular base) without moving it back.

As @Supuhstar pointed out, this is just an operating system doing leap seconds. But the leap seconds have a true physical origin and were introduced to compensate for the variation between the two definitions of UTC and TAI - the physical changes in the Earth's rotation rate. I will expand on this in this other



All Articles