xref: /freebsd/contrib/ts/ts.1 (revision 24e4dcf4ba5e9dedcf89efd358ea3e1fe5867020)
1.\"	$OpenBSD: ts.1,v 1.6 2022/06/30 21:40:41 jmc Exp $
2.\"
3.\" Copyright (c) 2022 Job Snijders <job@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd June 30, 2022
18.Dt TS 1
19.Os
20.Sh NAME
21.Nm ts
22.Nd timestamp input
23.Sh SYNOPSIS
24.Nm
25.Op Fl i | s
26.Op Fl m
27.Op Ar format
28.Sh DESCRIPTION
29The
30.Nm
31utility prepends a timestamp to each line of standard input and writes
32it to standard output.
33.Pp
34The options are as follows:
35.Bl -tag -width Ds
36.It Fl i
37Display time elapsed since the last timestamp.
38.It Fl m
39Display timestamps derived from a strictly linearly increasing clock.
40Without
41.Fl m ,
42timestamps reflect the current date and time, including time jumps if the
43system time is changed.
44.It Fl s
45Display time elapsed since the start of the program.
46.El
47.Pp
48The optional
49.Ar format
50argument controls how the timestamp is displayed, according to the conversion
51specifications described in the
52.Xr strftime 3
53manual page.
54The default format is
55.Qq %b %d %H:%M:%S ;
56or
57.Qq %H:%M:%S
58if one of the
59.Fl i
60or
61.Fl s
62options is used.
63.Pp
64Some additional conversion specifications are also supported
65to append microsecond resolution:
66.Cm %.S ,
67.Cm %.s ,
68and
69.Cm %.T ;
70which are similar to
71.Cm %S ,
72.Cm %s ,
73and
74.Cm \&%T .
75Examples:
76.Qq 10.00001 ,
77.Qq 1656427781.00001 ,
78and
79.Qq 4:20:00.00001 .
80.Sh EXAMPLES
81.Bd -literal -offset indent
82$ (echo foo; sleep 2; echo bar) | ts
83Jun 28 12:13:38 foo
84Jun 28 12:13:40 bar
85
86$ ls | ts -i %.S
8700.000452 CVS
8800.000595 Makefile
8900.000004 ts.1
9000.000004 ts.c
91.Ed
92.Sh SEE ALSO
93.Xr strftime 3
94.Sh HISTORY
95A
96.Nm
97utility first appeared in the moreutils collection by Joey Hess, and was
98rewritten from scratch for
99.Ox 7.2 .
100.Pp
101It was imported to
102.Fx
103by
104.An -nosplit
105.An Juraj Lutter Aq Mt otis@FreeBSD.org .
106.Sh AUTHORS
107This
108.Nm
109utility was written by
110.An Job Snijders Aq Mt job@openbsd.org
111and
112.An Claudio Jeker Aq Mt claudio@openbsd.org .
113