*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> gettimeofday (3c)              
Title
Content
Arch
Section
 

Contents


GETTIMEOFDAY(3B)					      GETTIMEOFDAY(3B)


NAME    [Toc]    [Back]

     gettimeofday, settimeofday	- get/set date and time

SYNOPSIS    [Toc]    [Back]

     #include <sys/time.h>

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

     System V:
     int gettimeofday(struct timeval *tp, ...);

     int settimeofday(struct timeval *tp, ...);

     BSD:
     int BSDgettimeofday(struct	timeval	*tp, struct timezone *tzp);

     int BSDsettimeofday(struct	timeval	*tp, struct timezone *tzp);

DESCRIPTION    [Toc]    [Back]

     The system's notion of the	current	time is	obtained with the gettimeofday
     and BSDgettimeofday calls.	 The time is expressed in seconds and
     microseconds since	midnight (00:00) Coordinated Universal Time (UTC),
     January 1,	1970.  The resolution for (BSD)gettimeofday is never worse
     than 100 HZ (which	equals 10 milliseconds).  The actual resolution	of
     (BSD)gettimeofday depends on the timer capability of the underlying
     hardware(see timers(5)).

     The difference between the	calls gettimeofday(settimeofday) and
     BSDgettimeofday(BSDsettimeofday) is the additional	second argument	tzp in
     the latter.

     In	IRIX, the time zone used by each process is determined by the TZ
     environment variable.  The	tzp argument is	present	in the BSD calls only
     for compatibility.	 It cannot be used to set the time zone	for the
     system, and so must be zero for settimeofday.  If tzp is not zero,
     BSDgettimeofday will return an interpretation of the TIMEZONE environment
     variable.

     The structures pointed to by tp and tzp are defined in <sys/time.h> as:

     struct timeval {
	  time_t    tv_sec;	   /* seconds since Jan. 1, 1970 */
	  long tv_usec;	      /* and microseconds */
     };

     struct timezone {
	  int  tz_minuteswest;	   /* of Greenwich */
	  int  tz_dsttime;    /* type of dst correction	to apply */
     };





									Page 1






GETTIMEOFDAY(3B)					      GETTIMEOFDAY(3B)



     The timezone structure indicates the local	time zone (measured in minutes
     of	time westward from Greenwich), and a flag that,	if nonzero, indicates
     that Daylight Saving time applies locally during the appropriate part of
     the year.

     Only the super-user may set the time of day or time zone.

     These routines emulate the	4.3BSD system calls.

RETURN    [Toc]    [Back]

     A 0 return	value indicates	that the call succeeded.  A -1 return value
     indicates an error	occurred, and in this case an error code is stored
     into the global variable errno.

ERRORS    [Toc]    [Back]

     The following error codes may be set in errno:

     [EFAULT]	    An argument	address	referenced invalid memory.

     [EPERM]	    A user other than the super-user attempted to set the
		    time.

     [EINVAL]	    An attempt to change the timezone was made.

SEE ALSO    [Toc]    [Back]

      
      
     date(1), time(2), stime(2), ctime(3C), see	timers(5) for details on the
     resolution.


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
gettimeofday Tru64 Gets and sets date and time and converts time between timeval and timeval64
TIMEVAL64TO32 Tru64 Gets and sets date and time and converts time between timeval and timeval64
TIMEVAL32TO64 Tru64 Gets and sets date and time and converts time between timeval and timeval64
gettimeofday64 Tru64 Gets and sets date and time and converts time between timeval and timeval64
settimeofday Tru64 Gets and sets date and time and converts time between timeval and timeval64
settimeofday64 Tru64 Gets and sets date and time and converts time between timeval and timeval64
ftime Tru64 Gets and sets date and time and converts time between timeval and timeval64
ntp_gettime Tru64 Get the date, time, and kernel time error values
ntpdate Tru64 set the date and time via NTP (Network Time Protocol)
ntpdate FreeBSD set the date and time via NTP
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service