1FAKETIME(1) wolfcw FAKETIME(1)
2
3
4
6 faketime - manipulate the system time for a given command
7
9 faketime [options] timestamp program [arguments...]
10
12 The given command will be tricked into believing that the current sys‐
13 tem time is the one specified in the timestamp. Filesystem timestamps
14 will also be reported relative to this timestamp. The wall clock will
15 continue to run from this date and time unless specified otherwise (see
16 advanced options). Actually, faketime is a simple wrapper for libfake‐
17 time, which uses the LD_PRELOAD mechanism to load a small library which
18 intercepts system calls to functions such as time(2) and fstat(2). This
19 wrapper exposes only a subset of libfaketime's functionality; please
20 refer to the README file that came with faketime for more details and
21 advanced options, or have a look at http://github.com/wolfcw/libfake‐
22 time
23
25 --help show usage information and quit.
26
27 --version
28 show version information and quit.
29
30 -m use the multi-threading variant of libfaketime.
31
32 -f use the advanced timestamp specification format.
33
34 --exclude-monotonic
35 Do not fake time when the program makes a call to clock_gettime
36 with a CLOCK_MONOTONIC clock.
37
38
40 faketime 'last Friday 5 pm' /bin/date
41 faketime '2008-12-24 08:15:42' /bin/date
42 faketime -f '+2,5y x10,0' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
43 faketime -f '+2,5y x0,50' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
44 faketime -f '+2,5y i2,0' /bin/bash -c 'while true; do date ; sleep 1 ; done'
45 In this single case all spawned processes will use the same global clock without restarting it at the start of each process.
46
47 (Please note that it depends on your locale settings whether . or , has to be used for fractional offsets)
48
50 The simple timestamp format used by default applies the /bin/date -d
51 command to parse user-friendly specifications such as 'last friday'.
52 When using the faketime option -f, the timestamp specified on the com‐
53 mand line is directly passed to libfaketime, which enables a couple of
54 additional features such as speeding the clock up or slowing it down
55 for the target program. It is strongly recommended that you have a look
56 at the libfaketime documentation. Summary:
57
58 Freeze clock at absolute timestamp: "YYYY-MM-DD hh:mm:ss"
59 If you want to specify an absolute point in time, exactly this
60 format must be used. Please note that freezing the clock is usu‐
61 ally not what you want and may break the application. Only use
62 if you know what you're doing!
63
64 Relative time offset: "[+/-]123[m/h/d/y], e.g. "+60m", "+2y"
65 This is the most often used format and specifies the faked time
66 relatively to the current real time. The first character of the
67 format string must be a + or a -. The numeric value by default
68 represents seconds, but the modifiers m, h, d, and y can be used
69 to specify minutes, hours, days, or years, respectively. For
70 example, "-2y" means "two years ago". Fractional time offsets
71 can be used, e.g. "+2,5y", which means "two and a half years in
72 the future". Please note that the fraction delimiter depends on
73 your locale settings, so if "+2,5y" does not work, you might
74 want to try "+2.5y".
75
76 Start-at timestamps: "@YYYY-MM-DD hh:mm:ss"
77 The wall clock will start counting at the given timestamp for
78 the program. This can be used for specifying absolute timestamps
79 without freezing the clock.
80
82 When using relative time offsets or start-at timestamps (see ADVANCED
83 TIMESTAMP FORMAT above and option -f), the clock speed can be adjusted,
84 i.e. time may run faster or slower for the executed program. For exam‐
85 ple, "+5y x10" will set the faked time 5 years into the future and make
86 the time pass 10 times as fast (one real second equals 10 seconds mea‐
87 sured by the program). Similarly, the flow of time can be slowed, e.g.
88 using "-7d x0,2", which will set the faked time 7 days in the past and
89 set the clock speed to 20 percent, i.e. it takes five real world sec‐
90 onds for one second measured by the program. Again, depending on your
91 locale, either "x2.0" or "x2,0" may be required regarding the delim‐
92 iter. You can also make faketime to advance the reported time by a pre‐
93 set interval upon each time() call independently from the system's time
94 using "-7d i2,0", where "i" is followed by the increase interval in
95 seconds.
96
97 Faking times for multiple programs or even system-wide can be simpli‐
98 fied by using ~/.faketimerc files and /etc/faketimerc. Please refer to
99 the README that came with faketime for warnings and details.
100
101 Faking of filesystem timestamps may be disabled by setting the
102 NO_FAKE_STAT environment variable to a non-empty value.
103
105 Please see the README and NEWS files for contributors.
106
108 Due to limitations of the LD_PRELOAD mechanism, faketime will not work
109 with suidroot and statically linked programs. While timestamps and
110 time offsets will work for child processes, speeding the clock up or
111 slowing it down might not work for child processes spawned by the exe‐
112 cuted program as expected; a new instance of libfaketime is used for
113 each child process, which means that the libfaketime start time, which
114 is used in speed adjustments, will also be re-initialized. Some pro‐
115 grams may dynamically load system libraries, such as librt, at run-time
116 and therefore bypass libfaketime. You may report programs that do not
117 work with libfaketime, but only if they are available as open source.
118
120 Please use https://github.com/wolfcw/libfaketime/issues
121
123 Copyright © 2003-2013 by the libfaketime authors.
124
125 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
126 PARTICULAR PURPOSE. You may redistribute copies of faketime under the
127 terms of the GNU General Public License.
128 For more information about these matters, see the file named COPYING.
129
131 ld.so(1), time(2), fstat(2)
132
133
134
135faketime 0.9.8 August 2019 FAKETIME(1)