summaryrefslogtreecommitdiff
path: root/usr/src/man/man3c/gettimeofday.3c
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2011-03-14 14:05:30 -0400
committerRichard Lowe <richlowe@richlowe.net>2011-03-14 14:05:30 -0400
commitc10c16dec587a0662068f6e2991c29ed3a9db943 (patch)
treef414286f4bba41d75683ed4fbbaa6bfa4bf7fabd /usr/src/man/man3c/gettimeofday.3c
parent68caef18a23a498d9e3017b983562c0f4fd8ab23 (diff)
downloadillumos-joyent-c10c16dec587a0662068f6e2991c29ed3a9db943.tar.gz
243 system manual pages should live with the software
Reviewed by: garrett@nexenta.com Reviewed by: gwr@nexenta.com Reviewed by: trisk@opensolaris.org Approved by: gwr@nexenta.com --HG-- extra : rebase_source : 0c599d0bec0dc8865fbba67721a7a6cd6b1feefb
Diffstat (limited to 'usr/src/man/man3c/gettimeofday.3c')
-rw-r--r--usr/src/man/man3c/gettimeofday.3c132
1 files changed, 132 insertions, 0 deletions
diff --git a/usr/src/man/man3c/gettimeofday.3c b/usr/src/man/man3c/gettimeofday.3c
new file mode 100644
index 0000000000..a45d5478db
--- /dev/null
+++ b/usr/src/man/man3c/gettimeofday.3c
@@ -0,0 +1,132 @@
+'\" te
+.\" Copyright 1989 AT&T. Copyright (c) 1980 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution. Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
+.TH gettimeofday 3C "1 Aug 2003" "SunOS 5.11" "Standard C Library Functions"
+.SH NAME
+gettimeofday, settimeofday \- get or set the date and time
+.SH SYNOPSIS
+.LP
+.nf
+#include <sys/time.h>
+
+\fBint\fR \fBgettimeofday\fR(\fBstruct timeval *\fR\fItp\fR, \fBvoid *\fR\fItzp\fR);
+.fi
+
+.LP
+.nf
+\fBint\fR \fBsettimeofday\fR(\fBstruct timeval *\fR\fItp\fR, \fBvoid *\fR\fItzp\fR);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The \fBgettimeofday()\fR function gets and the \fBsettimeofday()\fR 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.
+.sp
+.LP
+The \fItp\fR argument points to a \fBtimeval\fR structure, which includes the
+following members:
+.sp
+.in +2
+.nf
+long tv_sec; /* seconds since Jan. 1, 1970 */
+long tv_usec; /* and microseconds */
+.fi
+.in -2
+
+.sp
+.LP
+If \fItp\fR is a null pointer, the current time information is not returned or
+set.
+.sp
+.LP
+The \fBTZ\fR environment variable holds time zone information. See
+\fBTIMEZONE\fR(4).
+.sp
+.LP
+The \fItzp\fR argument to \fBgettimeofday()\fR and \fBsettimeofday()\fR is
+ignored.
+.sp
+.LP
+Only privileged processes can set the time of day.
+.SH RETURN VALUES
+.sp
+.LP
+Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
+returned and \fBerrno\fR is set to indicate the error.
+.SH ERRORS
+.sp
+.LP
+The \fBsettimeofday()\fR function will fail if:
+.sp
+.ne 2
+.mk
+.na
+\fB\fBEINVAL\fR\fR
+.ad
+.RS 10n
+.rt
+The structure pointed to by \fItp\fR specifies an invalid time.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fBEPERM\fR\fR
+.ad
+.RS 10n
+.rt
+The {\fBPRIV_SYS_TIME\fR} privilege was not asserted in the effective set of
+the calling process.
+.RE
+
+.sp
+.LP
+The \fBgettimeofday()\fR function will fail for 32-bit interfaces if:
+.sp
+.ne 2
+.mk
+.na
+\fB\fBEOVERFLOW\fR\fR
+.ad
+.RS 13n
+.rt
+The system time has progressed beyond 2038, thus the size of the \fBtv_sec\fR
+member of the \fBtimeval\fR structure pointed to by \fItp\fR is insufficient to
+hold the current time in seconds.
+.RE
+
+.SH USAGE
+.sp
+.LP
+If the \fBtv_usec\fR member of \fItp\fR is > 500000, \fBsettimeofday()\fR
+rounds the seconds upward. If the time needs to be set with better than one
+second accuracy, call \fBsettimeofday()\fR for the seconds and then
+\fBadjtime\fR(2) for finer accuracy.
+.SH ATTRIBUTES
+.sp
+.LP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+
+.sp
+.TS
+tab() box;
+cw(2.75i) |cw(2.75i)
+lw(2.75i) |lw(2.75i)
+.
+ATTRIBUTE TYPEATTRIBUTE VALUE
+_
+Interface Stability\fBgettimeofday()\fR is Standard.
+_
+MT-LevelMT-Safe
+.TE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBadjtime\fR(2), \fBctime\fR(3C), \fBgethrtime\fR(3C), \fBTIMEZONE\fR(4),
+\fBattributes\fR(5), \fBprivileges\fR(5), \fBstandards\fR(5)