I need a way to get the elapsed time (wall clock time) from the moment the program was launched so that it was stable for users interacting with the system clock.
On Windows, the non-standard implementation of clock () does not do the trick, since it seems to work just by calculating the difference with the time selected at startup, so that I get negative values if I “move the clock backward”.
On UNIX, the / getrusage clock refers to system time, while using a function such as gettimeofday to select timestamps has the same problem as using a clock in windows.
I am not interested in accuracy, and I hacked into the solution, having a half second timer rotating in the background, counteracting the clock when it happens (if the difference between the sampling time and the expected value exceeds 1 second, I use the expected timer for a new baseline), but I think there should be a better way.
ellevi
source share