March 2018
Beginner to intermediate
416 pages
9h 24m
English
The systime() function returns the current time of day as the number of seconds elapsed since midnight, January 1 1970, not counting leap seconds. This allows you to create a log file containing a timestamp using a seconds since the epoch format. This function can also be used to compare the timestamp with a file with the current time of day and for measuring how long a GAWK program takes to execute. The following example shows how the systime() function works:
$ vi systime.awkBEGIN { print "Timestamp of program run : ", systime() LOOPS=10000000; start=systime(); print start; for (i=0;i<LOOPS;i++) { } end = systime(); print end; totaltime = ( end -start ) print ("totaltime : ", totaltime)}$ awk -f systime.awk
The output ...
Read now
Unlock full access