how to set time in linux in that way:
1 second define as 10 seconds (10 second = 1 secods of own time)
I want fool all processes runned there to use 10x faster time.
so sleep(1)
will last 0.1 real seconds.
how to achieve it?
how to set time in linux in that way:
1 second define as 10 seconds (10 second = 1 secods of own time)
I want fool all processes runned there to use 10x faster time.
so sleep(1)
will last 0.1 real seconds.
how to achieve it?
You can run a command (including a shell and all of its children) with an arbitrary faster clock frequency by using the warp
command from the ast-open package. It uses LD_PRELOAD, so won't work with setuid or setgid or (now relatively rare) statically-linked programs. From the warp man page:
warp [ options ] date [ command [ arg ... ] ]
warp executes a dynamically linked command in a different time frame by intercepting time related system calls and modifying the times seen by command using the formula:
time' = time + warp + (time - base) * (factor - 1)
where warp is date-now, base is date by default, and factor is 1 by default.
OPTIONS
-b, --base=date
Set the base or starting date to date. Useful for repeating a set of tests. The default value is date.
-f, --factor=factor
Set the warped clock to tick at factor seconds per real second. The default value is 1.
warp executes command with optional args, or sh if command is omitted. All processes executed by command are warped in the same time frame. Time progresses for command and its children at the rate of factor times the system clock. Any files created by command or its children will appear newer than date to command and its children, but will actually be in the normal time frame for non-warped commands.