wolfcw / libfaketime

libfaketime modifies the system time for a single application
https://github.com/wolfcw/libfaketime
GNU General Public License v2.0
2.62k stars 319 forks source link

faketime would change the system tick time to unix timestamp ? #440

Open mrmgxxxx opened 8 months ago

mrmgxxxx commented 8 months ago

my a.out which is a simple test tools, it could show the local CLOCK_MONOTONIC time, and it works like:

image

but I run the faketime command, the tick CLOCK_MONOTONIC time would be changed to unix timestamp,

image

Is that a problem or did I miss the applicable instructions?

mrmgxxxx commented 8 months ago

a.out code:

#include <stdio.h>
#include <time.h>

int main() 
{
    struct timespec current_time;

    clock_gettime(CLOCK_MONOTONIC, &current_time);

    printf("Current tick time: %lld.%09ld seconds since epoch\n", (long long)current_time.tv_sec, current_time.tv_nsec);

    return 0;
}
mrmgxxxx commented 8 months ago

faketime version:

Version 0.9.10
mrmgxxxx commented 8 months ago

Is there any way not to change the tick time?