gettimeofday man page on SmartOS

Printed from http://www.polarhome.com/service/man/?qf=gettimeofday&af=0&tf=2&of=SmartOS

GETTIMEOFDAY(3C)					      GETTIMEOFDAY(3C)

NAME
       gettimeofday, settimeofday - get or set the date and time

SYNOPSIS
       #include <sys/time.h>

       int gettimeofday(struct timeval *tp, void *tzp);

       int settimeofday(struct timeval *tp, void *tzp);

DESCRIPTION
       The  gettimeofday()  function gets and the settimeofday() function sets
       the system's notion of the current time. The current time is  expressed
       in  elapsed  seconds and microseconds since 00:00 Universal Coordinated
       Time, January 1, 1970. The resolution of the system clock  is  hardware
       dependent; the time may be updated continuously or in clock ticks.

       The  tp argument points to a timeval structure, which includes the fol‐
       lowing members:

	 long	 tv_sec;    /* seconds since Jan. 1, 1970 */
	 long	 tv_usec;   /* and microseconds */

       If tp is a null pointer, the current time information is	 not  returned
       or set.

       The  TZ	environment  variable  holds  time zone information. See TIME‐
       ZONE(4).

       The tzp argument to gettimeofday() and settimeofday() is ignored.

       Only privileged processes can set the time of day.

RETURN VALUES
       Upon successful completion, 0 is returned.  Otherwise, −1  is  returned
       and errno is set to indicate the error.

ERRORS
       The settimeofday() function will fail if:

       EINVAL
		 The structure pointed to by tp specifies an invalid time.

       EPERM
		 The  {PRIV_SYS_TIME} privilege was not asserted in the effec‐
		 tive set of the calling process.

       The gettimeofday() function will fail for 32-bit interfaces if:

       EOVERFLOW
		    The system time has progressed beyond 2038, thus the  size
		    of	the  tv_sec member of the timeval structure pointed to
		    by tp is insufficient to hold the current time in seconds.

USAGE
       If the tv_usec member of tp is > 500000, settimeofday() rounds the sec‐
       onds  upward.  If  the time needs to be set with better than one second
       accuracy, call settimeofday() for the seconds and then  adjtime(2)  for
       finer accuracy.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌────────────────────┬─────────────────────────────┐
       │  ATTRIBUTE TYPE    │	    ATTRIBUTE VALUE	  │
       ├────────────────────┼─────────────────────────────┤
       │Interface Stability │ gettimeofday() is Standard. │
       ├────────────────────┼─────────────────────────────┤
       │MT-Level	    │ MT-Safe			  │
       └────────────────────┴─────────────────────────────┘

SEE ALSO
       adjtime(2), ctime(3C), gethrtime(3C), TIMEZONE(4), attributes(5), priv‐
       ileges(5), standards(5)

				  Aug 1, 2003		      GETTIMEOFDAY(3C)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net