SNOBOL4TIME(3) | CSNOBOL4B 2.2 | December 5, 2020

NAME

snobol4time – SNOBOL4 time functions

SYNOPSIS

-INCLUDE 'time.sno'

DESCRIPTION

GETTIMEOFDAY()
function returns a DATA() object of type TIMEVAL with members TV_SEC (seconds since 1/1/1970 GMT) and TV_NSEC (nanoseconds since start of day starting in CSNOBOL4 2.2). For compatibility with older versions of CSNOBOL, TV_USEC contains microseconds since start of day).

LOCALTIME(sec)
takes seconds since 1/1/1970, and returns a DATA() object of type TM with the following members:
  • TM_SEC seconds since start of local minute (0 to 60)
  • TM_MIN minutes since start of local hour (0 to 59)
  • TM_HOUR hours since start of local day (0 to 23)
  • TM_MDAY day of month (1 to 31)
  • TM_MON month of year (0 to 11)
  • TM_YEAR year minus 1900
  • TM_WDAY day of week (sunday = 0)
  • TM_YDAY day of year (0 to 365)
  • TM_ISDST is non-zero if summer time in effect at that time
  • TM_GMTOFF offset from UTC in seconds (or -1 if not available)

    GMTIME(sec)
    converts seconds to a TM object, but without any local time zone adjustments.

    MKTIME(tm)
    converts the TM object representing a date/time in the current timezone setting to seconds since 1/1/1970 UTC.

    TIMEGM(tm)
    converts the TM object representing a UTC date/time to seconds since 1/1/1970 UTC.

    SLEEP(fp_sec)
    suspends program execution for a number of (floating point) seconds. Not all platforms may support sleep, or sleep for fractional seconds. Sleep resolution may vary between platforms. May return failure if the system indicated the sleep time was less than the requested time.

    STRFTIME(format,tm)
    formats the date information in tm according to the format string. Consult your local strftime(3) manual page (or C runtime manual) for more details.

    STRPTIME(str,format)
    parses a string using using the supplied format and returns a TM object with the parsed elements filled in. Consult your local strptime(3) manual page (or C runtime manual) for more details.
  • SEE ALSO

    snobol4(1), ctime(3), strftime(3), strptime(3)

    AUTHOR

    Philip L. Budne