| 1 |
.TH TIME 3am "Jul 11 2022" "Free Software Foundation" "GNU Awk Extension Modules" |
| 2 |
.SH NAME |
| 3 |
time \- time functions for gawk |
| 4 |
.SH SYNOPSIS |
| 5 |
.ft CW |
| 6 |
@load "time" |
| 7 |
.sp |
| 8 |
time = gettimeofday() |
| 9 |
.br |
| 10 |
ret = sleep(amount) |
| 11 |
.ft R |
| 12 |
.SH CAUTION |
| 13 |
This extension is deprecated in favor of the |
| 14 |
.B timex |
| 15 |
extension in the |
| 16 |
.I gawkextlib |
| 17 |
project. |
| 18 |
Loading it issues a warning. |
| 19 |
It will be removed from the |
| 20 |
.I gawk |
| 21 |
distribution in the next major release. |
| 22 |
.SH DESCRIPTION |
| 23 |
The |
| 24 |
.I time |
| 25 |
extension adds two functions named |
| 26 |
.B gettimeofday() |
| 27 |
and |
| 28 |
.BR sleep() , |
| 29 |
as follows. |
| 30 |
.TP |
| 31 |
.B gettimeofday() |
| 32 |
This function returns the number of seconds since the Epoch |
| 33 |
as a floating-point value. It should have subsecond precision. |
| 34 |
It returns \-1 upon error and sets |
| 35 |
.B ERRNO |
| 36 |
to indicate the problem. |
| 37 |
.TP |
| 38 |
.BI sleep( seconds ) |
| 39 |
This function attempts to sleep for the given amount of seconds, which |
| 40 |
may include a fractional portion. |
| 41 |
If |
| 42 |
.I seconds |
| 43 |
is negative, or the attempt to sleep fails, |
| 44 |
then it returns \-1 and sets |
| 45 |
.BR ERRNO . |
| 46 |
Otherwise, the function should return 0 after sleeping |
| 47 |
for the indicated amount of time. |
| 48 |
.\" .SH NOTES |
| 49 |
.\" .SH BUGS |
| 50 |
.SH EXAMPLE |
| 51 |
.ft CW |
| 52 |
.nf |
| 53 |
@load "time" |
| 54 |
\&... |
| 55 |
printf "It is now %g seconds since the Epoch\en", gettimeofday() |
| 56 |
printf "Pausing for a while... " ; sleep(2.5) ; print "done" |
| 57 |
.fi |
| 58 |
.ft R |
| 59 |
.SH "SEE ALSO" |
| 60 |
.IR "GAWK: Effective AWK Programming" , |
| 61 |
.IR filefuncs (3am), |
| 62 |
.IR fnmatch (3am), |
| 63 |
.IR fork (3am), |
| 64 |
.IR inplace (3am), |
| 65 |
.IR ordchr (3am), |
| 66 |
.IR readdir (3am), |
| 67 |
.IR readfile (3am), |
| 68 |
.IR revoutput (3am), |
| 69 |
.IR rwarray (3am). |
| 70 |
.PP |
| 71 |
.IR gettimeofday (2), |
| 72 |
.IR nanosleep (2), |
| 73 |
.IR select (2). |
| 74 |
.SH AUTHOR |
| 75 |
Arnold Robbins, |
| 76 |
.BR [email protected] . |
| 77 |
.SH COPYING PERMISSIONS |
| 78 |
Copyright \(co 2012, 2013, 2018, 2022, |
| 79 |
Free Software Foundation, Inc. |
| 80 |
.PP |
| 81 |
Permission is granted to make and distribute verbatim copies of |
| 82 |
this manual page provided the copyright notice and this permission |
| 83 |
notice are preserved on all copies. |
| 84 |
.ig |
| 85 |
Permission is granted to process this file through troff and print the |
| 86 |
results, provided the printed document carries copying permission |
| 87 |
notice identical to this one except for the removal of this paragraph |
| 88 |
(this paragraph not being relevant to the printed manual page). |
| 89 |
.. |
| 90 |
.PP |
| 91 |
Permission is granted to copy and distribute modified versions of this |
| 92 |
manual page under the conditions for verbatim copying, provided that |
| 93 |
the entire resulting derived work is distributed under the terms of a |
| 94 |
permission notice identical to this one. |
| 95 |
.PP |
| 96 |
Permission is granted to copy and distribute translations of this |
| 97 |
manual page into another language, under the above conditions for |
| 98 |
modified versions, except that this permission notice may be stated in |
| 99 |
a translation approved by the Foundation. |
| 100 |
.\" vim: set filetype=nroff : |