gawk: Extension Sample Time
1
1 16.7.11 Extension Time Functions
1 --------------------------------
1
1 The 'time' extension adds two functions, named 'gettimeofday()' and
1 'sleep()', as follows:
1
1 '@load "time"'
1 This is how you load the extension.
1
1 'the_time = gettimeofday()'
1 Return the time in seconds that has elapsed since 1970-01-01 UTC as
1 a floating-point value. If the time is unavailable on this
1 platform, return -1 and set 'ERRNO'. The returned time should have
1 sub-second precision, but the actual precision may vary based on
1 the platform. If the standard C 'gettimeofday()' system call is
1 available on this platform, then it simply returns the value.
1 Otherwise, if on MS-Windows, it tries to use
1 'GetSystemTimeAsFileTime()'.
1
1 'result = sleep(SECONDS)'
1 Attempt to sleep for SECONDS seconds. If SECONDS is negative, or
1 the attempt to sleep fails, return -1 and set 'ERRNO'. Otherwise,
1 return zero after sleeping for the indicated amount of time. Note
1 that SECONDS may be a floating-point (nonintegral) value.
1 Implementation details: depending on platform availability, this
1 function tries to use 'nanosleep()' or 'select()' to implement the
1 delay.
1