1FAKETIME(1)                         wolfcw                         FAKETIME(1)
2
3
4

NAME

6       faketime - manipulate the system time for a given command
7

SYNOPSIS

9       faketime [options] timestamp program [arguments...]
10

DESCRIPTION

12       The  given command will be tricked into believing that the current sys‐
13       tem time is the one specified in the timestamp.  The  wall  clock  will
14       continue to run from this date and time unless specified otherwise (see
15       advanced options). Actually, faketime is a simple wrapper for  libfake‐
16       time, which uses the LD_PRELOAD mechanism to load a small library which
17       intercepts system calls to functions such as time(2) and fstat(2). This
18       wrapper  exposes  only  a subset of libfaketime's functionality; please
19       refer to the README file that came with faketime for more  details  and
20       advanced  options,  or have a look at http://github.com/wolfcw/libfake
21       time
22

OPTIONS

24       --help show usage information and quit.
25
26       --version
27              show version information and quit.
28
29       -m     use the multi-threading variant of libfaketime.
30
31       -f     use the advanced timestamp specification format.
32
33

EXAMPLES

35       faketime 'last Friday 5 pm' /bin/date
36       faketime '2008-12-24 08:15:42' /bin/date
37       faketime -f '+2,5y x10,0' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
38       faketime -f '+2,5y x0,50' /bin/bash -c 'date; while true; do echo $SECONDS ; sleep 1 ; done'
39       faketime -f '+2,5y i2,0' /bin/bash -c 'while true; do date ; sleep 1 ; done'
40       In this single case all spawned processes will use the same global clock without restaring it at the start of each process.
41
42       (Please note that it depends on your locale settings whether . or , has to be used for fractional offsets)
43

ADVANCED TIMESTAMP FORMAT

45       The simple timestamp format used by default applies  the  /bin/date  -d
46       command  to  parse  user-friendly specifications such as 'last friday'.
47       When using the faketime option -f, the timestamp specified on the  com‐
48       mand  line is directly passed to libfaketime, which enables a couple of
49       additional features such as speeding the clock up or  slowing  it  down
50       for the target program. It is strongly recommended that you have a look
51       at the libfaketime documentation. Summary:
52
53       Freeze clock at absolute timestamp: "YYYY-MM-DD hh:mm:ss"
54              If you want to specify an absolute point in time,  exactly  this
55              format must be used. Please note that freezing the clock is usu‐
56              ally not what you want and may break the application.  Only  use
57              if you know what you're doing!
58
59       Relative time offset: "[+/-]123[m/h/d/y], e.g. "+60m", "+2y"
60              This  is the most often used format and specifies the faked time
61              relatively to the current real time. The first character of  the
62              format  string  must be a + or a -. The numeric value by default
63              represents seconds, but the modifiers m, h, d, and y can be used
64              to  specify  minutes,  hours,  days, or years, respectively. For
65              example, "-2y" means "two years ago".  Fractional  time  offsets
66              can  be used, e.g. "+2,5y", which means "two and a half years in
67              the future". Please note that the fraction delimiter depends  on
68              your  locale  settings,  so  if "+2,5y" does not work, you might
69              want to try "+2.5y".
70
71       Start-at timestamps: "@YYYY-MM-DD hh:mm:ss"
72              The wall clock will start counting at the  given  timestamp  for
73              the program. This can be used for specifying absolute timestamps
74              without freezing the clock.
75

ADVANCED USAGE

77       When using relative time offsets or start-at timestamps  (see  ADVANCED
78       TIMESTAMP FORMAT above and option -f), the clock speed can be adjusted,
79       i.e. time may run faster or slower for the executed program. For  exam‐
80       ple, "+5y x10" will set the faked time 5 years into the future and make
81       the time pass 10 times as fast (one real second equals 10 seconds  mea‐
82       sured  by the program). Similarly, the flow of time can be slowed, e.g.
83       using "-7d x0,2", which will set the faked time 7 days in the past  and
84       set  the  clock speed to 20 percent, i.e. it takes five real world sec‐
85       onds for one second measured by the program. Again, depending  on  your
86       locale,  either  "x2.0"  or "x2,0" may be required regarding the delim‐
87       iter. You can also make faketime to advance the reported time by a pre‐
88       set interval upon each time() call independently from the system's time
89       using "-7d i2,0", where "i" is followed by  the  increase  interval  in
90       seconds.
91
92       Faking  times  for multiple programs or even system-wide can be simpli‐
93       fied by using ~/.faketimerc files and /etc/faketimerc. Please refer  to
94       the README that came with faketime for warnings and details.
95

AUTHOR

97       Please see the README and NEWS files for contributers.
98

BUGS

100       Due  to limitations of the LD_PRELOAD mechanism, faketime will not work
101       with suidroot and statically linked  programs.   While  timestamps  and
102       time  offsets  will  work for child processes, speeding the clock up or
103       slowing it down might not work for child processes spawned by the  exe‐
104       cuted  program  as  expected; a new instance of libfaketime is used for
105       each child process, which means that the libfaketime start time,  which
106       is  used  in  speed adjustments, will also be re-initialized. Some pro‐
107       grams may dynamically load system libraries, such as librt, at run-time
108       and  therefore  bypass libfaketime. You may report programs that do not
109       work with libfaketime, but only if they are available as open source.
110

REPORTING BUGS

112       Please use https://github.com/wolfcw/libfaketime/issues
113
115       Copyright © 2003-2013 by the libfaketime authors.
116
117       There is NO warranty; not even for MERCHANTABILITY  or  FITNESS  FOR  A
118       PARTICULAR  PURPOSE.  You may redistribute copies of faketime under the
119       terms of the GNU General Public License.
120       For more information about these matters, see the file named COPYING.
121

SEE ALSO

123       ld.so(1), time(2), fstat(2)
124
125
126
127faketime 0.9.6                     June 2014                       FAKETIME(1)
Impressum