Lines Matching refs:code

111 @code{clock_t} is used to measure processor and CPU time.
123 @code{time_t} is the simplest data type used to represent simple
126 In ISO C, @code{time_t} can be either an integer or a floating-point
127 type, and the meaning of @code{time_t} values is not specified. The
128 only things a strictly conforming program can do with @code{time_t}
129 values are: pass them to @code{difftime} to get the elapsed time
134 On POSIX-conformant systems, @code{time_t} is an integer type and its
138 @Theglibc{} additionally guarantees that @code{time_t} is a signed
140 @code{time_t} values, which are interpreted as times before the epoch.
147 @code{struct timespec} represents a simple calendar time, or an
151 @table @code
159 @code{tv_sec} member.
161 When @code{struct timespec} values are produced by @glibcadj{}
164 When @code{struct timespec} values are supplied to @glibcadj{}
172 @code{struct timeval} is an older type for representing a simple
174 almost the same as @code{struct timespec}, but provides only
178 @table @code
186 @code{tv_sec} member.
188 When @code{struct timeval} values are produced by @glibcadj{}
191 When @code{struct timeval} values are supplied to @glibcadj{}
213 The @code{difftime} function returns the number of seconds of elapsed
215 a value of type @code{double}.
221 would overflow. However, if they are so far apart that a @code{double}
224 On other systems, @code{time_t} values might be encoded in a way that
225 prevents subtraction from working directly, and then @code{difftime}
230 difference between two values of type @w{@code{struct timeval}} or
231 @w{@code{struct timespec}}. Here is the recommended way to do this
233 where the @code{tv_sec} member has an unsigned type.
249 @code{clock_t}, which is a number of @dfn{clock ticks}. It gives the
260 On @gnulinuxhurdsystems{}, @code{clock_t} is equivalent to @code{long int} and
261 @code{CLOCKS_PER_SEC} is an integer value. But in other systems, both
262 @code{clock_t} and the macro @code{CLOCKS_PER_SEC} can be either integer
263 or floating-point types. Casting CPU time values to @code{double}, as
269 @code{CLOCKS_PER_SEC} set to one million this function will return the
277 * CPU Time:: The @code{clock} function.
278 * Processor Time:: The @code{times} function.
284 To get a process' CPU time, you can use the @code{clock} function. This
288 In typical usage, you call the @code{clock} function at the beginning
290 divide by @code{CLOCKS_PER_SEC} (the number of clock ticks per second)
319 by the @code{clock} function. POSIX requires that this value be one
332 time is not available or cannot be represented, @code{clock} returns the
333 value @code{(clock_t)(-1)}.
340 The @code{times} function returns information about a process'
341 consumption of processor time in a @w{@code{struct tms}} object, in
350 The @code{tms} structure is used to return information about process
353 @table @code
363 This is the sum of the @code{tms_utime} values and the @code{tms_cutime}
365 status has been reported to the parent process by @code{wait} or
366 @code{waitpid}; see @ref{Process Completion}. In other words, it
369 child processes which have not yet been reported by @code{wait} or
370 @code{waitpid}.
374 This is similar to @code{tms_cutime}, but represents the total processor
387 @code{sysconf (_SC_CLK_TCK)} instead.
398 The @code{times} function stores the processor time information for
402 in the past, e.g. since system start-up. @code{times} returns
403 @code{(clock_t)(-1)} to indicate failure.
406 @strong{Portability Note:} The @code{clock} function described in
408 @code{times} function is a feature of POSIX.1. On @gnusystems{}, the
409 CPU time is defined to be equivalent to the sum of the @code{tms_utime}
410 and @code{tms_stime} fields returned by @code{times}.
443 It returns the calendar time as a value of type @code{time_t}; on
450 value is also stored in @code{*@var{result}}.
456 a @code{time_t} alone. Some applications also need more control over
458 provides a function @code{clock_gettime} that can retrieve the time
464 clock with the function @code{clock_getres}. There is no function to
470 The type @code{clockid_t} is used for constants that indicate which of
481 clocks of @code{time} (above) and of @code{gettimeofday} (below).
498 Therefore, @code{CLOCK_MONOTONIC} cannot be used to measure
507 storing it as seconds and nanoseconds in @code{*@var{ts}}.
508 @xref{Time Types}, for a description of @code{struct timespec}.
510 The return value is @code{0} on success and @code{-1} on failure. The
511 following @code{errno} error condition is defined for this function:
513 @table @code
519 @code{clock_gettime} reports the time scaled to seconds and
528 storing it in @code{*@var{ts}}.
530 For instance, if the clock hardware for @code{CLOCK_REALTIME}
534 @code{r.tv_sec} to 0 and @code{r.tv_nsec} to 30518.
536 The return value is @code{0} on success and @code{-1} on failure. The
537 following @code{errno} error condition is defined for this function:
539 @table @code
549 older versions of @theglibc{}, programs that use @code{clock_gettime}
550 or @code{clock_setres} must be linked with the @code{-lrt} library.
561 in @code{*@var{tp}}. @xref{Time Types}, for a description of
562 @code{struct timeval}. The clock of @code{gettimeofday} is close to,
563 but not necessarily in lock-step with, the clocks of @code{time} and of
568 @code{*@var{tzp}}. This feature is obsolete and not supported on
573 This function cannot fail, and its return value is always @code{0}.
578 @code{clock_gettime} instead.
597 @var{clock}, to be the simple calendar time in @code{*@var{ts}}.
600 @code{CLOCK_REALTIME} clock can be changed (with the appropriate
601 privileges), but the @code{CLOCK_MONOTONIC} clock cannot.
608 @code{clock_settime} causes the clock to jump forwards or backwards,
610 @code{CLOCK_REALTIME} clock with @code{clock_settime} does not affect
614 it is better to use @code{ntp_adjtime} (below) to make a smooth
617 The return value is @code{0} on success and @code{-1} on failure. The
618 following @code{errno} error conditions are defined for this function:
620 @table @code
623 at all, or the simple calendar time in @code{*@var{ts}} is invalid
624 (for instance, @code{ts->tv_nsec} is negative or greater than 999,999,999).
632 older versions of @theglibc{}, programs that use @code{clock_settime}
633 must be linked with the @code{-lrt} library. This has not been
645 The @code{ntp_gettime} and @code{ntp_adjtime} functions provide an
663 @table @code
665 The current calendar time, as if retrieved by @code{gettimeofday}.
666 The @code{struct timeval} data type is described in
671 via @code{ntp_adjtime} periodically, this value will reach some
676 be set by @code{ntp_adjtime} to indicate the estimated offset of the
685 The @code{ntp_gettime} function sets the structure pointed to by
688 might or might not be correct. If they are not, an @code{ntp_adjtime}
691 The return value is @code{0} on success and other values on failure. The
692 following @code{errno} error conditions are defined for this function:
694 @vtable @code
706 @table @code
710 the effective mode. These constants start with @code{MOD_}.
715 @code{MOD_OFFSET} is set in @code{modes}, the offset (and possibly other
717 exceed @code{MAXPHASE}.
723 PPM (parts per million, 0.0001%). The scaling is @code{1 <<
724 SHIFT_USEC}. The value can be set with bit @code{MOD_FREQUENCY}, but
725 the absolute value must not exceed @code{MAXFREQ}.
729 set using bit @code{MOD_MAXERROR}. Unless updated via
730 @code{ntp_adjtime} periodically, this value will increase steadily
735 be set using bit @code{MOD_ESTERROR}.
740 @code{STA_}. Some of these flags can be updated using the
741 @code{MOD_STATUS} bit.
746 bit @code{MOD_TIMECONST}.
754 scaled PPM. This value is used to increase the @code{maxerror} every
776 interval, ranging from @code{PPS_SHIFT} to @code{PPS_SHIFTMAX}.
784 the allowed maximum @code{MAXTIME}.
803 The @code{ntp_adjtime} function sets the structure specified by
806 In addition, @code{ntp_adjtime} updates some settings to match what
807 you pass to it in @code{*@var{tptr}}. Use the @code{modes} element of
808 @code{*@var{tptr}} to select what settings to update. You can set
809 @code{offset}, @code{freq}, @code{maxerror}, @code{esterror},
810 @code{status}, @code{constant}, and @code{tick}.
812 @code{modes} = zero means set nothing.
823 The return value is @code{0} on success and other values on failure. The
824 following @code{errno} error conditions are defined for this function:
826 @table @code
842 have this function, but did have the synonymous @code{adjtimex}.
853 This simpler version of @code{ntp_adjtime} speeds up or slows down the
856 reported by the @code{CLOCK_REALTIME} clock, at the price of having to
864 If the @var{olddelta} argument is not a null pointer, the @code{adjtime}
868 The return value is @code{0} on success and @code{-1} on failure. The
869 following @code{errno} error condition is defined for this function:
871 @table @code
874 @code{CLOCK_REALTIME} clock.
886 Change the @code{CLOCK_REALTIME} calendar time to be the simple
887 calendar time in @code{*@var{newtime}}. Calling this function is
896 The return value is @code{0} on success and @code{-1} on failure. The
897 following @code{errno} error condition is defined for this function:
899 @table @code
902 @code{CLOCK_REALTIME} clock.
909 @code{adjtimex} is an older name for @code{ntp_adjtime}.
917 Change the @code{CLOCK_REALTIME} calendar time to be the simple
918 calendar time in @code{*@var{newtime}}. This function is declared in
931 The return value is @code{0} on success and @code{-1} on failure. The
932 following @code{errno} error conditions are defined for this function:
934 @table @code
937 @code{CLOCK_REALTIME} clock.
973 @table @code
976 in the range @code{0} through @code{59}, but the actual upper limit is
977 @code{60}, to allow for leap seconds if leap second support is
983 range @code{0} through @code{59}).
986 This is the number of full hours past midnight (in the range @code{0} through
987 @code{23}).
990 This is the ordinal day of the month (in the range @code{1} through @code{31}).
996 year (in the range @code{0} through @code{11}). Watch out for this one!
1003 This is the number of full days since Sunday (in the range @code{0} through
1004 @code{6}).
1008 range @code{0} through @code{365}).
1023 example, for U.S. Eastern Standard Time, the value is @code{-5*60*60}.
1024 The @code{tm_gmtoff} field is derived from BSD and is a GNU library
1029 broken-down time value. Like @code{tm_gmtoff}, this field is a BSD and
1041 The @code{localtime} function converts the simple time pointed to by
1046 might be overwritten by subsequent calls to @code{ctime}, @code{gmtime},
1047 or @code{localtime}. (But no other library function overwrites the contents
1052 an @code{int}.
1054 Calling @code{localtime} also sets the current time zone as if
1055 @code{tzset} were called. @xref{Time Zone Functions}.
1058 Using the @code{localtime} function is a big problem in multi-threaded
1145 The @code{localtime_r} function works just like the @code{localtime}
1150 in the object of type @code{struct tm} to which the parameter
1163 This function is similar to @code{localtime}, except that the broken-down
1169 As for the @code{localtime} function we have the problem that the result
1171 @code{gmtime}.
1184 This function is similar to @code{localtime_r}, except that it converts
1185 just like @code{gmtime} the given time as Coordinated Universal Time.
1217 The @code{mktime} function converts a broken-down time structure to a
1222 The @code{mktime} function ignores the specified contents of the
1223 @code{tm_wday}, @code{tm_yday}, @code{tm_gmtoff}, and @code{tm_zone}
1228 @code{mktime} does is adjust the components of the @var{brokentime}
1232 @code{mktime} returns a value of @code{(time_t)(-1)} and does not modify
1235 Calling @code{mktime} also sets the current time zone as if
1236 @code{tzset} were called; @code{mktime} uses this information instead
1237 of @var{brokentime}'s initial @code{tm_gmtoff} and @code{tm_zone}
1246 @code{timelocal} is functionally identical to @code{mktime}, but more
1247 mnemonically named. Note that it is the inverse of the @code{localtime}
1250 @strong{Portability note:} @code{mktime} is essentially universally
1251 available. @code{timelocal} is rather rare.
1271 @code{timegm} is functionally identical to @code{mktime} except it
1275 Note that @code{timegm} is the inverse of @code{gmtime}.
1277 @strong{Portability note:} @code{mktime} is essentially universally
1278 available. @code{timegm} is rather rare. For the most portable
1280 the @code{TZ} environment variable to UTC, call @code{mktime}, then set
1281 @code{TZ} back.
1303 The @code{asctime} function converts the broken-down time value that
1318 overwritten by subsequent calls to @code{asctime} or @code{ctime}.
1328 This function is similar to @code{asctime} but instead of placing the
1335 it returns @code{NULL}.
1345 The @code{ctime} function is similar to @code{asctime}, except that you
1346 specify the calendar time argument as a @code{time_t} simple time value
1353 Calling @code{ctime} also sets the current time zone as if
1354 @code{tzset} were called. @xref{Time Zone Functions}.
1363 This function is similar to @code{ctime}, but places the result in the
1373 it returns @code{NULL}.
1436 This function is similar to the @code{sprintf} function (@pxref{Formatted
1450 @table @code
1480 @table @code
1483 modifier applies to the @code{%c}, @code{%C}, @code{%x}, @code{%X},
1484 @code{%y} and @code{%Y} format specifiers. In a Japanese locale, for
1485 example, @code{%Ex} might yield a date format based on the Japanese
1492 With @code{%B}, @code{%b}, and @code{%h}: use the grammatical form for
1495 part of a complete date. The @code{%OB} and @code{%Ob} formats are a
1509 @table @code
1520 the @code{O} modifier can be used (@code{%Ob}) to get the grammatical
1527 the @code{O} modifier can be used (@code{%OB}) to get the grammatical
1531 names, so the text produced by @code{%B} and @code{%OB}, and by
1532 @code{%b} and @code{%Ob}, may or may not be the same, depending on
1542 If the @code{E} modifier is specified (@code{%EC}), instead produces
1549 The day of the month as a decimal number (range @code{01} through @code{31}).
1552 The date using the format @code{%m/%d/%y}.
1557 The day of the month like with @code{%d}, but padded with spaces (range
1558 @code{ 1} through @code{31}).
1563 The date using the format @code{%Y-%m-%d}. This is the form specified
1570 (range @code{00} through @code{99}). This has the same format and value
1571 as @code{%y}, except that if the ISO week number (see @code{%V}) belongs
1578 and value as @code{%Y}, except that if the ISO week number (see
1579 @code{%V}) belongs to the previous or next year, that year is used
1587 is the same as for @code{%b}.
1592 The hour as a decimal number, using a 24-hour clock (range @code{00} through
1593 @code{23}).
1596 The hour as a decimal number, using a 12-hour clock (range @code{01} through
1597 @code{12}).
1600 The day of the year as a decimal number (range @code{001} through @code{366}).
1603 The hour as a decimal number, using a 24-hour clock like @code{%H}, but
1604 padded with spaces (range @code{ 0} through @code{23}).
1609 The hour as a decimal number, using a 12-hour clock like @code{%I}, but
1610 padded with spaces (range @code{ 1} through @code{12}).
1615 The month as a decimal number (range @code{01} through @code{12}).
1618 The minute as a decimal number (range @code{00} through @code{59}).
1629 @samp{AM}/@samp{PM} format is not supported, in such cases @code{"%p"}
1641 @code{"%P"} yields an empty string.
1649 In the POSIX locale, this format is equivalent to @code{%I:%M:%S %p}.
1652 The hour and minute in decimal numbers using the format @code{%H:%M}.
1664 The seconds as a decimal number (range @code{00} through @code{60}).
1672 The time of day using decimal numbers using the format @code{%H:%M:%S}.
1677 The day of the week as a decimal number (range @code{1} through
1678 @code{7}), Monday being @code{1}.
1683 The week number of the current year as a decimal number (range @code{00}
1684 through @code{53}), starting with the first Sunday as the first day of
1686 considered to be in week @code{00}.
1689 The @w{ISO 8601:1988} week number as a decimal number (range @code{01}
1690 through @code{53}). ISO weeks start with Monday and end with Sunday.
1691 Week @code{01} of a year is the first week which has the majority of its
1694 4. Week @code{01} of a year can contain days from the previous year.
1695 The week before week @code{01} of a year is the last week (@code{52} or
1696 @code{53}) of the previous year even if it contains days from the new
1702 The day of the week as a decimal number (range @code{0} through
1703 @code{6}), Sunday being @code{0}.
1706 The week number of the current year as a decimal number (range @code{00}
1707 through @code{53}), starting with the first Monday as the first day of
1709 considered to be in week @code{00}.
1718 The year without a century as a decimal number (range @code{00} through
1719 @code{99}). This is equivalent to the year modulo 100.
1721 If the @code{E} modifier is specified (@code{%Ey}), instead produces
1723 Unlike @code{%y}, the number is @emph{not} reduced modulo 100.
1725 can be overridden by an explicit field width or by the @code{_} and
1726 @code{-} flags).
1730 before the year @code{1} are numbered @code{0}, @code{-1}, and so on.
1732 If the @code{E} modifier is specified (@code{%EY}), instead produces a
1735 information produced by @code{%EC} and @code{%Ey}. As a GNU
1736 extension, the formatting flags @code{_} or @code{-} may be used with
1741 @code{-0600} or @code{+0100}), or nothing if no time zone is
1761 characters, @code{strftime} returns zero and the contents of the array
1772 @code{"%p"} will return the empty string, i.e., the return value is
1774 code should be used:
1786 If @var{s} is a null pointer, @code{strftime} does not actually write
1789 Calling @code{strftime} also sets the current time zone as if
1790 @code{tzset} were called; @code{strftime} uses this information
1791 instead of @var{brokentime}'s @code{tm_gmtoff} and @code{tm_zone}
1794 For an example of @code{strftime}, see @ref{Time Functions Example}.
1846 The @code{wcsftime} function is equivalent to the @code{strftime}
1856 source code using the @code{L"@dots{}"} notation. The parameter
1857 @var{brokentime} has the same meaning as in the @code{strftime} call.
1859 The @code{wcsftime} function supports the same flags, modifiers, and
1860 format specifiers as the @code{strftime} function.
1862 The return value of @code{wcsftime} is the number of wide characters
1863 stored in @code{s}. When more characters would have to be written than
1865 same problems indicated in the @code{strftime} documentation.
1872 the output of the @code{strftime} function back into a binary format.
1875 extended by the addition of two functions: @code{strptime} and
1876 @code{getdate}. Both have strange interfaces but at least they are
1890 implementation are heavily influenced by the @code{getdate} function,
1891 which is defined and implemented in terms of calls to @code{strptime}.
1921 The @code{strptime} function parses the input string @var{s} according
1925 The input string could be generated by a @code{strftime} call or
1927 format; e.g. a date passed as @code{"02:1999:9"} is acceptable, even
1932 unambiguous way. The string @code{"1999112"} can be parsed using the
1933 format @code{"%Y%m%d"} as 1999-1-12, 1999-11-2, or even 19991-1-2. It
1937 of the @code{strftime} function. The only difference is that the flags
1938 @code{_}, @code{-}, @code{0}, and @code{^} are not allowed.
1940 Several of the distinct formats of @code{strftime} do the same work in
1941 @code{strptime} since differences like case of the input do not matter.
1944 The modifiers @code{E} and @code{O} are also allowed everywhere the
1945 @code{strftime} function allows them.
1949 @table @code
1963 As a GNU extension, the @code{O} modifier can be used with these
1971 Like @code{%c} but the locale's alternative date and time format is used.
1977 contains the @code{%y} format.
1982 Unlike @code{%C} it sometimes makes sense to use this format since some
1988 The day of the month as a decimal number (range @code{1} through @code{31}).
1993 Same as @code{%d} but using the locale's alternative numeric symbols.
1998 Equivalent to @code{%m/%d/%y}.
2001 Equivalent to @code{%Y-%m-%d}, which is the @w{ISO 8601} date
2005 @code{strftime}.
2009 (range @code{00} through @code{99}).
2014 This format is a GNU extension following a GNU extension of @code{strftime}.
2022 This format is a GNU extension following a GNU extension of @code{strftime}.
2026 The hour as a decimal number, using a 24-hour clock (range @code{00} through
2027 @code{23}).
2029 @code{%k} is a GNU extension following a GNU extension of @code{strftime}.
2032 Same as @code{%H} but using the locale's alternative numeric symbols.
2036 The hour as a decimal number, using a 12-hour clock (range @code{01} through
2037 @code{12}).
2039 @code{%l} is a GNU extension following a GNU extension of @code{strftime}.
2042 Same as @code{%I} but using the locale's alternative numeric symbols.
2045 The day of the year as a decimal number (range @code{1} through @code{366}).
2050 The month as a decimal number (range @code{1} through @code{12}).
2055 Same as @code{%m} but using the locale's alternative numeric symbols.
2058 The minute as a decimal number (range @code{0} through @code{59}).
2063 Same as @code{%M} but using the locale's alternative numeric symbols.
2073 This format is not useful unless @code{%I} or @code{%l} is also used.
2077 @code{%P} is a GNU extension following a GNU extension to @code{strftime}.
2086 The hour and minute in decimal numbers using the format @code{%H:%M}.
2088 @code{%R} is a GNU extension following a GNU extension to @code{strftime}.
2094 @code{%s} is a GNU extension following a GNU extension to @code{strftime}.
2097 The seconds as a decimal number (range @code{0} through @code{60}).
2102 is @code{61}, a result of a decision to allow double leap seconds. You
2103 will not see the value @code{61} because no minute has more than one
2107 Same as @code{%S} but using the locale's alternative numeric symbols.
2110 Equivalent to the use of @code{%H:%M:%S} in this place.
2113 The day of the week as a decimal number (range @code{1} through
2114 @code{7}), Monday being @code{1}.
2122 The week number of the current year as a decimal number (range @code{0}
2123 through @code{53}).
2128 Same as @code{%U} but using the locale's alternative numeric symbols.
2131 The @w{ISO 8601:1988} week number as a decimal number (range @code{1}
2132 through @code{53}).
2140 The day of the week as a decimal number (range @code{0} through
2141 @code{6}), Sunday being @code{0}.
2149 Same as @code{%w} but using the locale's alternative numeric symbols.
2152 The week number of the current year as a decimal number (range @code{0}
2153 through @code{53}).
2161 Same as @code{%W} but using the locale's alternative numeric symbols.
2167 Like @code{%x} but the locale's alternative data representation is used.
2173 Like @code{%X} but the locale's alternative time representation is used.
2176 The year without a century as a decimal number (range @code{0} through
2177 @code{99}).
2182 the @code{%C} format. The @code{strptime} function does regard input
2188 Therefore it is best to avoid @code{%y} completely and use @code{%Y}
2192 The offset from @code{%EC} in the locale's alternative representation.
2195 The offset of the year (from @code{%C}) using the locale's alternative
2222 at least one whitespace character (as specified by @code{isspace}) or
2226 @code{"%d%m%Y%H%M%S"}.
2228 The @code{strptime} function processes the input string from right to
2238 points to the @code{NULL} byte at the end of the string. If an error
2239 occurs, i.e., @code{strptime} fails to match all of the format string,
2240 the function returns @code{NULL}.
2250 directly initialized. Exceptions are the @code{tm_wday} and
2251 @code{tm_yday} elements, which are recomputed if any of the year, month,
2256 Before calling the @code{strptime} function for a new input string, you
2259 fields to values like @code{INT_MAX}, allowing you to determine which
2267 You can construct a @code{struct tm} value with several consecutive
2268 @code{strptime} calls. A useful application of this is e.g. the parsing
2310 This variable of type @code{int} contains the error code of the last
2311 unsuccessful call to @code{getdate}. Defined values are:
2315 The environment variable @code{DATEMSK} is not defined or null.
2317 The template file denoted by the @code{DATEMSK} environment variable
2332 in a @code{time_t} variable.
2341 The interface to @code{getdate} is the simplest possible for a function
2348 variable @code{DATEMSK}. This file should contain
2349 lines of valid format strings which could be passed to @code{strptime}.
2351 The @code{getdate} function reads these format strings one after the
2356 present at the time of the @code{getdate} function call.
2358 The formats recognized by @code{getdate} are the same as for
2359 @code{strptime}. See above for an explanation. There are only a few
2360 extensions to the @code{strptime} behavior:
2364 If the @code{%Z} format is given the broken-down time is based on the
2370 given string (say @code{EST} meaning US East Coast time), then uses for
2376 date. If the current weekday is greater than or equal to the @code{tm_wday}
2411 @code{run job at %I %p,%B %dnd}. Using the above list of templates and
2434 type @w{@code{struct tm}}, or a null pointer if an error occurred. The
2435 result is only valid until the next @code{getdate} call, making this
2438 The @code{errno} variable is @emph{not} changed. Error conditions are
2439 stored in the global variable @code{getdate_err}. See the
2442 @emph{Warning:} The @code{getdate} function should @emph{never} be
2444 @code{DATEMSK} environment variable you can get the function to open
2475 The @code{getdate_r} function is the reentrant counterpart of
2476 @code{getdate}. It does not use the global variable @code{getdate_err}
2477 to signal an error, but instead returns an error code. The same error
2478 codes as described in the @code{getdate_err} documentation above are
2481 Moreover, @code{getdate_r} stores the broken-down time in the variable
2482 of type @code{struct tm} pointed to by the second argument, rather than
2488 The warning against using @code{getdate} in SUID-programs applies to
2489 @code{getdate_r} as well.
2493 @subsection Specifying the Time Zone with @code{TZ}
2496 @code{TZ} environment variable. For information about how to set
2502 You should not normally need to set @code{TZ}. If the system is
2504 set @code{TZ} if you are using a computer over a network from a
2508 In POSIX.1 systems the value of the @code{TZ} variable can be in one of
2533 [@code{+}|@code{-}]@var{hh}[@code{:}@var{mm}[@code{:}@var{ss}]]. This
2535 negative if it is east. The hour must be between @code{0} and
2536 @code{24}, and the minute and seconds between @code{0} and @code{59}.
2548 …ar{std} @var{offset} @var{dst} [@var{offset}]@code{,}@var{start}[@code{/}@var{time}]@code{,}@var{e…
2561 @table @code
2563 This specifies the Julian day, with @var{n} between @code{1} and @code{365}.
2567 This specifies the Julian day, with @var{n} between @code{0} and @code{365}.
2572 @var{d} must be between @code{0} (Sunday) and @code{6}. The week
2573 @var{w} must be between @code{1} and @code{5}; week @code{1} is the
2574 first week in which day @var{d} occurs, and week @code{5} specifies the
2576 between @code{1} and @code{12}.
2581 @code{02:00:00}. The hours part of the time fields can range from
2585 Here are some example @code{TZ} values, including the appropriate
2611 daylight saving time is in effect all year and the initial @code{WART}
2650 If the @code{TZ} environment variable does not have a value, the
2680 The array @code{tzname} contains two strings, which are the standard
2682 Saving) that the user has selected. @code{tzname[0]} is the name of
2683 the standard time zone (for example, @code{"EST"}), and @code{tzname[1]}
2685 example, @code{"EDT"}). These correspond to the @var{std} and @var{dst}
2686 strings (respectively) from the @code{TZ} environment variable. If
2687 Daylight Saving Time is never used, @code{tzname[1]} is the empty string.
2689 The @code{tzname} array is initialized from the @code{TZ} environment
2690 variable whenever @code{tzset}, @code{ctime}, @code{strftime},
2691 @code{mktime}, or @code{localtime} is called. If multiple abbreviations
2692 have been used (e.g. @code{"EWT"} and @code{"EDT"} for U.S. Eastern War
2696 The @code{tzname} array is required for POSIX.1 compatibility, but in
2697 GNU programs it is better to use the @code{tm_zone} member of the
2698 broken-down time structure, since @code{tm_zone} reports the correct
2701 Though the strings are declared as @code{char *} the user must refrain
2714 The @code{tzset} function initializes the @code{tzname} variable from
2715 the value of the @code{TZ} environment variable. It is not usually
2722 Unix. Like @code{tzname}, these variables are set by calling
2723 @code{tzset} or the other time conversion functions.
2729 zone, the value is @code{5*60*60}. Unlike the @code{tm_gmtoff} member
2732 to use @code{tm_gmtoff}, since it contains the correct offset even when
2766 The @code{alarm} and @code{setitimer} functions provide a mechanism for a
2779 @code{SIGALRM} signal to the process when it expires.
2785 sends a @code{SIGVTALRM} signal to the process when it expires.
2792 timer sends a @code{SIGPROF} signal to the process when it expires.
2798 native code.
2807 @code{signal} or @code{sigaction} before issuing a call to
2808 @code{setitimer} or @code{alarm}. Otherwise, an unusual chain of events
2815 @code{SA_RESTART} flag when registering the signal handler using
2816 @code{sigaction}. When not using @code{sigaction} things get even
2817 uglier: the @code{signal} function has fixed semantics with respect
2819 Therefore, if @code{sigaction} for whatever reason cannot be used, it is
2820 necessary to use @code{sysv_signal} and not @code{signal}.
2822 The @code{setitimer} function is the primary means for setting an alarm.
2824 @code{alarm} function, declared in @file{unistd.h}, provides a somewhat
2833 @table @code
2843 The @code{struct timeval} data type is described in @ref{Time Types}.
2857 The @code{setitimer} function sets the timer specified by @var{which}
2859 @code{ITIMER_REAL}, @code{ITIMER_VIRTUAL}, or @code{ITIMER_PROF}.
2861 If @var{old} is not a null pointer, @code{setitimer} returns information
2865 The return value is @code{0} on success and @code{-1} on failure. The
2866 following @code{errno} error conditions are defined for this function:
2868 @table @code
2877 The @code{getitimer} function stores information about the timer specified
2880 The return value and error conditions are the same as for @code{setitimer}.
2883 @vtable @code
2887 @code{setitimer} and @code{getitimer} functions to specify the real-time
2893 @code{setitimer} and @code{getitimer} functions to specify the virtual
2899 @code{setitimer} and @code{getitimer} functions to specify the profiling
2907 The @code{alarm} function sets the real-time timer to expire in
2909 can do this by calling @code{alarm} with a @var{seconds} argument of
2913 alarm would have been sent. If there was no previous alarm, @code{alarm}
2917 The @code{alarm} function could be defined in terms of @code{setitimer}
2936 There is an example showing the use of the @code{alarm} function in
2940 you should use the @code{sleep} function. @xref{Sleeping}.
2946 @strong{Portability Note:} The @code{setitimer} and @code{getitimer}
2947 functions are derived from BSD Unix, while the @code{alarm} function is
2948 specified by the POSIX.1 standard. @code{setitimer} is more powerful than
2949 @code{alarm}, but @code{alarm} is more widely used.
2954 The function @code{sleep} gives a simple way to make the program wait
2956 terminate), then you can expect @code{sleep} to wait reliably throughout
2957 the specified interval. Otherwise, @code{sleep} can return sooner if a
2959 signals, use @code{select} (@pxref{Waiting for I/O}) and don't specify
2969 The @code{sleep} function waits for @var{seconds} seconds or until a signal
2972 If @code{sleep} returns because the requested interval is over,
2976 The @code{sleep} function is declared in @file{unistd.h}.
2980 using the return value of @code{sleep}, when nonzero, to call
2981 @code{sleep} again. This will work with a certain amount of accuracy as
2990 @code{select} and make the waiting period quite accurate. (Of course,
2995 On some systems, @code{sleep} can do strange things if your program uses
2996 @code{SIGALRM} explicitly. Even if @code{SIGALRM} signals are being
2997 ignored or blocked when @code{sleep} is called, @code{sleep} might
2998 return prematurely on delivery of a @code{SIGALRM} signal. If you have
2999 established a handler for @code{SIGALRM} signals and a @code{SIGALRM}
3001 might be just to cause @code{sleep} to return instead of invoking your
3002 handler. And, if @code{sleep} is interrupted by delivery of a signal
3003 whose handler requests an alarm or alters the handling of @code{SIGALRM},
3004 this handler and @code{sleep} will interfere.
3006 On @gnusystems{}, it is safe to use @code{sleep} and @code{SIGALRM} in
3007 the same program, because @code{sleep} does not work by means of
3008 @code{SIGALRM}.
3015 If resolution to seconds is not enough the @code{nanosleep} function can
3021 @code{*@var{requested_time}} is the elapsed time of the interval you
3024 The function returns as @code{*@var{remaining}} the elapsed time left
3028 @code{struct timespec} is described in @ref{Time Types}.
3031 zero. If the function returns @math{-1} the global variable @code{errno}
3034 @table @code
3049 descriptors, semaphores or whatever) at the time @code{nanosleep} is
3051 until the program ends. To avoid this calls to @code{nanosleep} should
3055 The @code{nanosleep} function is declared in @file{time.h}.