OpenBSD CVS

CVS log for src/usr.bin/ts/ts.c


[BACK] Up to [local] / src / usr.bin / ts

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.11 / (download) - annotate - [select for diffs], Tue Oct 11 07:36:27 2022 UTC (19 months, 1 week ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

fix unintended sizeof pointer introduced in 1.10
ok cheloha@ miod@ matthieu@ martijn@

Revision 1.10 / (download) - annotate - [select for diffs], Thu Sep 1 00:14:36 2022 UTC (20 months, 2 weeks ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.9: +39 -11 lines
Diff to previous 1.9 (colored)

ts(1): parse user format string only once

Currently, ts(1) reparses the user format string every time it prints
a timestamp.  This is wasteful.

If we isolate the parsing loop in fmtfmt() and move the rest of the
work into a new function, fmtprint(), we can cut some overhead out
of the hot loop.

We still need to update any microsecond substrings in the parsed
format string every time we print a timestamp.  So during parsing in
fmtfmt() we build a list of pointers to locations in the parsed buffer
where the microsecond substring needs to be copied during fmtprint().

With input from deraadt@.

Link1: https://marc.info/?l=openbsd-tech&m=165769139318084&w=2
Link2: https://marc.info/?l=openbsd-tech&m=165910022501353&w=2

OK job@

Revision 1.9 / (download) - annotate - [select for diffs], Wed Aug 3 16:54:30 2022 UTC (21 months, 2 weeks ago) by job
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

Since ts(1) is line-based, always using line buffering

makes sense millert@
yep deraadt@

Revision 1.8 / (download) - annotate - [select for diffs], Thu Jul 7 10:40:25 2022 UTC (22 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.7: +13 -7 lines
Diff to previous 1.7 (colored)

Handle strange format strings better.

Make sure that the allocated buffers are not zero sized even for an empty
format string. Also do not call strftime if the buffer is empty. The return
value of strftime does not distinguish between an empty format string and
an overflow of the output buffer. Finally auto scale the size of the outbuf
in case strftime fails. Some format specifiers expand to 25 and more chars
so it is hard to guess in advance what size is required.
This may waste some memory but it keeps the code as simple as possible.
OK tb@

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jul 6 07:59:03 2022 UTC (22 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.6: +19 -16 lines
Diff to previous 1.6 (colored)

More ts(1) cleanup. Change main loop so that in interval mode only one
clock_gettime call is used resulting in more precise interval times.
Move the localtime call to fmtfmt() and rename the variable for the
micorsecond string to us.
Based on work done by cheloha@
OK job@ and cheloha@

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jul 4 17:29:03 2022 UTC (22 months, 2 weeks ago) by cheloha
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

ts(1): the first argument to clock_gettime(2) is a clockid_t, not an int

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jul 3 15:06:06 2022 UTC (22 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

thou shalt not include sys/cdefs.h because it is not standardized, the
file to be used is sys/types.h

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jun 30 07:55:48 2022 UTC (22 months, 2 weeks ago) by job
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

Fix err()

OK claudio@

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 30 07:42:50 2022 UTC (22 months, 2 weeks ago) by claudio
Branch: MAIN
Changes since 1.2: +21 -28 lines
Diff to previous 1.2 (colored)

Fix interval timers by forcing TZ to UTC, else some strftime formats
print strange offsets.

While there rework the main loop to only use localtime and now.
Calculate the relative time offset for -m mode just once at startup.
OK sthen@ job@

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jun 29 16:01:10 2022 UTC (22 months, 2 weeks ago) by job
Branch: MAIN
Changes since 1.1: +25 -11 lines
Diff to previous 1.1 (colored)

Add -m option to ts(1)

OK claudio@

Revision 1.1 / (download) - annotate - [select for diffs], Wed Jun 29 08:39:49 2022 UTC (22 months, 2 weeks ago) by job
Branch: MAIN

Import ts(1) - a timestamp utility

A from scratch & pledged implementation of the perl 'ts' utility found
in the moreutils collection.

With help from florian@, tb@, and deraadt@

OK deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.