Use clock_gettime() with CLOCK_MONOTONIC which is not affected by changing system...