-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdatefudge.man
115 lines (105 loc) · 4.16 KB
/
datefudge.man
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.\" vim:ft=nroff
.TH DATEFUDGE "1" "August 1th, 2019" "datefudge @VERSION@" Debian
.SH NAME
datefudge \- pretend the system time is different
.SH SYNOPSIS
\fBdatefudge\fR [\fB\-s\fR|\fB\-\-static\fR] [\fB\-l\fR|\fB\-\-add\-ld\-preload\fR \fIlib\fR]
[\fB\-f\fR|\fB\-\-from\-file\fR \fIdate_file_path\fR] [\fB\-c\fR|\fB\-\-cache\-file\-date\fR \fIms\fR] [\fIdate\fR] program\fR [\fIarguments\fR ...]
.SH DESCRIPTION
.PP
\fBdatefudge\fR is a small utility that pretends that the system time is different
by pre-loading a small library which modifies the
\fBtime\fR(2), \fBgettimeofday\fR(2) and \fBclock_gettime\fR(2) system calls.
.SH DATE FORMAT
The \fIat_date\fP argument can be given in any format accepted by the \fBdate\fP(1)
program, for example "2007\-04\-01 12:21" or "yesterday", or "next Friday".
.PP
The date passed to program inside \fIdate_file_path\fP supports full or partial
date-time string to the seconds level, for example "2007\-04\-01 12:21:12",
"2007\-04\-01 12", "2007\-04\-01" or "2007".
File is checked for updates at most each 100 milliseconds (this value can be
overriden by arg 'ms').
.SH OPTIONS
.TP
\fB\-\-static\fR, \fB\-s\fR
Mark the date as a `static' one. The above mentioned system calls will always return
the date given in the \fIat_date\fP argument, regardless of time passing. See EXAMPLES
below.
.TP
\fB\-\-add\-ld\-preload\fR \fIlib\fR, \fB\-l\fR \fIlib\fR
Prepend \fIlib\fR to \fILD_PRELOAD\fR environment variable before executing given
\fIprogram\fR. This option might be useful for example to inject sanitizer
libraries (e.g. from Address Sanitizer) to the list of preloaded libraries before the
internal \fBdatefudge\fR's library. See EXAMPLES below.
.TP
\fB\-\-help\fR, \fB\-h\fR
Print short usage information and exit.
.TP
\fB\-\-version\fR, \fB\-v\fR
Print version information and exit.
.SH EXAMPLES
.SS Basic examples:
.nf
\fI$ datefudge "2007\-04\-01 10:23" date \-R\fR
Sun, 01 Apr 2007 10:23:00 +0200
\fI$ datefudge "1 May 2007" date \-R\fR
Tue, 01 May 2007 00:00:00 +0200
\fI$ datefudge "2 weeks ago" date \-R\fR
Wed, 16 Jan 2008 13:32:12 +0100
.fi
.SS Date-time from file examples:
date.txt contains "2007\-04\-01 10:23:45".
.nf
\fI$ datefudge -f date.txt date \-R\fR
Sun, 01 Apr 2007 10:23:45 +0200
.fi
date.txt contains "2007\-04\-01 10".
.nf
\fI$ datefudge -f date.txt date \-R\fR
Sun, 01 Apr 2007 10:00:00 +0200
.fi
date.txt contains "2007\-04\-01".
.nf
\fI$ datefudge -f date.txt date \-R\fR
Sun, 01 Apr 2007 00:00:00 +0200
.fi
.SS Non-static vs. static example:
.nf
\fI$ datefudge "2007\-04\-01 10:23" sh \-c "\fBsleep 3\fI; date \-R"\fR
Sun, 01 Apr 2007 10:23:\fB03\fR +0200
\fI$ datefudge \fB\-\-static\fI "2007\-04\-01 10:23" sh \-c "\fBsleep 3\fI; date \-R"\fR
Sun, 01 Apr 2007 10:23:\fB00\fR +0200
.fi
.SS Prepending LD_PRELOAD example:
.nf
\fI$ datefudge \fB\-\-add\-ld\-preload /path/to/libclang_rt.asan\-x86_64.so\fI "2007\-04\-01 10:23" command\fR
If the \fIcommand\fR was compiled by 'clang \-fsanitize=address \-shared\-libasan', then the above
command might display some errors, for example:
==7625==ERROR: AddressSanitizer: heap\-use\-after\-free on address 0x614000000044 at pc ....
Without the \fB\-\-add\-ld\-preload\fR argument, this would not work at all.
.fi
.SH AUTHOR
Written by Matthias Urlichs <[email protected]>. Modified by
Robert Luberda <[email protected]>.
.SH BUGS
There is no attempt to make this change undetectable by the program.
In particular, file modification times are \fBnot\fR modified.
.PP
On systems using 32-bit representation of time, \fBdatefudge\fR is affected by the year
2038 problem, which might cause dates to be wrapped around, for instance:
.nf
\fI$ TZ=UTC datefudge "\fB2038\fR\fI\-01\-19 03:14:07" sh \-c "sleep 1; date \-R"\fR
Fri Dec 13 20:45:53 UTC \fB1901\fR
.fi
.SH COPYRIGHT
Copyright \(co 2003 by Matthias Urlichs.
.br
Copyright \(co 2008-2019 by Robert Luberda.
.PP
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. You may redistribute copies of datefudge under the
terms of the GNU General Public License.
.br
For more information about these matters, see the file named COPYING.
.SH "SEE ALSO"
\fBdate\fR(1), \fBld.so\fR(1), \fBtime\fR(2), \fBgettimeofday\fR(2), \fBclock_gettime\fR(2)