Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
gettimeofday(2)		      System Calls Manual	       gettimeofday(2)

NAME
       gettimeofday - get the date and time

SYNOPSIS
DESCRIPTION
       The  function  obtains  the  current time, expressed as seconds and mi-
       croseconds since	00:00 Coordinated Universal Time  (UTC),  January   1,
       1970,  and stores it in the structure pointed to	by tp.	The resolution
       of the system clock is unspecified.

       If tzp is not a null pointer, the application is	not a  UNIX-conforming
       application.   See  the section for treatment of	a non-null pointer for
       the tzp argument.

RETURN VALUE
       The function returns 0 and no value is reserved to indicate  an	error.
       See the section for function return values under	HP-UX.

ERRORS
       No errors are defined.  See the section for error values	under HP-UX.

SEE ALSO
       ctime(3C),   date(1),  ftime(2),	 settimeofday(2),  stime(2),  time(2),
       <sys/time.h>.

CHANGE HISTORY
       First released in Issue 4, Version 2.

gettimeofday(2)		      System Calls Manual	       gettimeofday(2)

				  HP-UX	EXTENSIONS

SYNOPSIS
DESCRIPTION
       When is called under HP-UX, extensions apply to the time	 zone  parame-
       ter, the	return value, and errors.

       If  the parameter is not	a null pointer,	it is interpreted as a pointer
       to a under HP-UX.  The has the following	fields:

       tz_minuteswest	The number of minutes that the local time zone is west
			of UTC.

       tz_dsttime	A  flag	that, if nonzero, indicates that Daylight Sav-
			ings Time (DST)	applies	locally	during the appropriate
			part of	the year.

       Programs	 should	 use this time zone information	only in	the absence of
       the environment variable.

   Security Restrictions
       Only a user with	appropriate privileges can set the time	of day.

RETURN VALUE
       return the following values under HP-UX:

	      Successful completion.
	      Failure.
		     is	set to indicate	the error.

ERRORS
       If fails, is set	to the following value under HP-UX:

	      [EFAULT]	     An	argument address  referenced  invalid  memory.
			     The reliable detection of this error is implemen-
			     tation dependent.

EXAMPLES
       The following HP-UX example calls twice.	 It then computes  the	lapsed
       time  between  the calls	in seconds and microseconds and	stores the re-
       sult in a timeval structure:

WARNINGS
       The microsecond value usually has a granularity much greater  than  one
       due  to the resolution of the system clock.  Relying on any granularity
       (particularly of	one) will render code nonportable.

AUTHOR
       was developed by	the University of California, Berkeley,	and HP.

SEE ALSO
       ctime(3C), date(1), ftime(2), stime(2), time(2),	<sys/time.h>.

							       gettimeofday(2)

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | SEE ALSO | CHANGE HISTORY | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | EXAMPLES | WARNINGS | AUTHOR | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=gettimeofday&sektion=2&manpath=HP-UX+11.22>

home | help