File: datefudge.man

package info (click to toggle)
datefudge 1.27
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 84 kB
  • sloc: sh: 88; ansic: 87; makefile: 68
file content (97 lines) | stat: -rw-r--r-- 3,855 bytes parent folder | download
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
.\" vim:ft=nroff
.TH DATEFUDGE "1" "January 13th, 2024" "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]
\fIat_date 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".
.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.  Please note
that sub-seconds part of the returned date is always set to 0. 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 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 Non-static with sub-seconds example:
.nf
\fI$ datefudge \fB\-\-static\fI "2007\-04\-01 10:23:45\fB.123456\fI" date +"%F %T %N"\fR
2007\-04\-01 10:23:45 \fB000000000\fR
.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 <smurf@noris.de>.  Modified by
Robert Luberda <robert@debian.org>.
.SH BUGS
There is no attempt to make this change undetectable by the program.
In particular, file modification times are \fBnot\fR modified.  (Note
that such a functionality might be provided by \fBfaketime\fR(1) program
available in libfaketime Debian package.)
.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-2024 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), \fBfaketime\fR(1)