mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 00:26:16 +03:00
doc: refer to commands by name, not absolute path
For simplicity and portability. I left some instances in README.OSX as is, because I'm worried about invalidating the docs.
This commit is contained in:
6
README
6
README
@@ -256,10 +256,10 @@ the difference:
|
||||
|
||||
LD_PRELOAD=src/libfaketime.so.1 FAKETIME="@2000-01-01 11:12:13" \
|
||||
FAKETIME_DONT_RESET=1 \
|
||||
/bin/bash -c 'while [ $SECONDS -lt 5 ]; do date; sleep 1; done'
|
||||
bash -c 'while [ $SECONDS -lt 5 ]; do date; sleep 1; done'
|
||||
|
||||
LD_PRELOAD=src/libfaketime.so.1 FAKETIME="@2000-01-01 11:12:13" \
|
||||
/bin/bash -c 'while [ $SECONDS -lt 5 ]; do date; sleep 1; done'
|
||||
bash -c 'while [ $SECONDS -lt 5 ]; do date; sleep 1; done'
|
||||
|
||||
In the second example, the "date" command will always print the same time,
|
||||
while in the first example, with FAKETIME_DONT_RESET set, time will increment
|
||||
@@ -354,7 +354,7 @@ like "+0 x2", i.e., use an explicit zero offset as a prefix in your FAKETIME.
|
||||
For testing, your should run a command like
|
||||
|
||||
LD_PRELOAD=./libfaketime.so.1 FAKETIME="+1,5y x10,0" \
|
||||
/bin/bash -c 'while true; do echo $SECONDS ; sleep 1 ; done'
|
||||
bash -c 'while true; do echo $SECONDS ; sleep 1 ; done'
|
||||
|
||||
For each second that the endless loop sleeps, the executed bash shell will
|
||||
think that 10 seconds have passed ($SECONDS is a bash-internal variable
|
||||
|
||||
@@ -40,11 +40,11 @@ Use a specific GNU-date compatible implementation of the helper used to transfor
|
||||
|
||||
.SH EXAMPLES
|
||||
.nf
|
||||
faketime 'last Friday 5 pm' /bin/date
|
||||
faketime '2008-12-24 08:15:42' /bin/date
|
||||
faketime -f '+2,5y x10,0' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
|
||||
faketime -f '+2,5y x0,50' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
|
||||
faketime -f '+2,5y i2,0' /bin/bash -c 'while true; do date ; sleep 1 ; done'
|
||||
faketime 'last Friday 5 pm' date
|
||||
faketime '2008-12-24 08:15:42' date
|
||||
faketime -f '+2,5y x10,0' bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
|
||||
faketime -f '+2,5y x0,50' bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
|
||||
faketime -f '+2,5y i2,0' bash -c 'while true; do date ; sleep 1 ; done'
|
||||
In this single case all spawned processes will use the same global clock without restarting it at the start of each process.
|
||||
|
||||
(Please note that it depends on your locale settings whether . or , has to be used for fractional offsets)
|
||||
|
||||
@@ -84,11 +84,11 @@ void usage(const char *name)
|
||||
" --date-prog PROG : Use specified GNU-compatible implementation of 'date' program\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
"%s 'last friday 5 pm' /bin/date\n"
|
||||
"%s '2008-12-24 08:15:42' /bin/date\n"
|
||||
"%s -f '+2,5y x10,0' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'\n"
|
||||
"%s -f '+2,5y x0,50' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'\n"
|
||||
"%s -f '+2,5y i2,0' /bin/bash -c 'date; while true; do date; sleep 1 ; done'\n"
|
||||
"%s 'last friday 5 pm' date\n"
|
||||
"%s '2008-12-24 08:15:42' date\n"
|
||||
"%s -f '+2,5y x10,0' bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'\n"
|
||||
"%s -f '+2,5y x0,50' bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'\n"
|
||||
"%s -f '+2,5y i2,0' bash -c 'date; while true; do date; sleep 1 ; done'\n"
|
||||
"In this single case all spawned processes will use the same global clock\n"
|
||||
"without restarting it at the start of each process.\n\n"
|
||||
"(Please note that it depends on your locale settings whether . or , has to be used for fractions)\n"
|
||||
|
||||
Reference in New Issue
Block a user