File: timestamp.awk

package info (click to toggle)
golang-github-containers-buildah 1.28.2%2Bds1-3%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,336 kB
  • sloc: sh: 2,291; makefile: 218; perl: 187; awk: 12; ansic: 1
file content (20 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


# This script is intended to be piped into by automation, in order to
# mark output lines with timing information.  For example:
#      /path/to/command |& awk --file timestamp.awk

BEGIN {
    STARTTIME=systime()
    printf "[%s] START", strftime("%T")
    printf " - All [+xxxx] lines that follow are relative to right now.\n"
}

{
    printf "[%+05ds] %s\n", systime()-STARTTIME, $0
}

END {
    printf "[%s] END", strftime("%T")
    printf " - [%+05ds] total duration since START\n", systime()-STARTTIME
}