summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2019-09-04 14:27:56 +0000
committercheloha <cheloha@cvs.openbsd.org>2019-09-04 14:27:56 +0000
commit6681649a730f668723a286f0514f80fe509c785f (patch)
tree0f14954e632b5e0cc84ab129417aa3a478947de4 /lib/libc
parent3b7be44fbd14b7474c7c2ae42871c66de17ba46d (diff)
gettimeofday, settimeofday(2): limit timezone support
For gettimeofday(2), always copy out an empty timezone struct. For settimeofday(2), still copyin(9) the struct but ignore the contents. In gettimeofday(2)'s case we have not changed the original BSD semantics: the kernel only tracks UTC time without an offset for DST, so a zeroed timezone struct is the correct thing to return to the caller. Future work could move these out into libc as stubs for clock_gettime and clock_settime(2). But, definitely a "later" thing, given that we are in beta. Update the manpage to de-emphasize the timezone parameters for these syscalls. Discussed with tedu@, deraadt@, millert@, kettenis@, yasuoka@, jca@, and guenther@. Tested by job@. Ports input from jca@ and sthen@. Manpage input from jca@. ok jca@ deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/gettimeofday.262
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/libc/sys/gettimeofday.2 b/lib/libc/sys/gettimeofday.2
index 3f32e7b6fbf..d12078671bc 100644
--- a/lib/libc/sys/gettimeofday.2
+++ b/lib/libc/sys/gettimeofday.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: gettimeofday.2,v 1.30 2019/01/18 05:03:42 cheloha Exp $
+.\" $OpenBSD: gettimeofday.2,v 1.31 2019/09/04 14:27:55 cheloha Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95
.\"
-.Dd $Mdocdate: January 18 2019 $
+.Dd $Mdocdate: September 4 2019 $
.Dt GETTIMEOFDAY 2
.Os
.Sh NAME
@@ -43,15 +43,9 @@
.Ft int
.Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp"
.Sh DESCRIPTION
-.Bf -symbolic
-Note: timezone is no longer used; this information is kept outside
-the kernel.
-.Ef
-.Pp
-The system's notion of the current Greenwich time and the current time
-zone is obtained with the
+The system's notion of the current Greenwich time is obtained with the
.Fn gettimeofday
-call, and set with the
+call and set with the
.Fn settimeofday
call.
The time is expressed in seconds and microseconds
@@ -61,18 +55,12 @@ may be updated continuously or in
.Dq ticks .
If
.Fa tp
-or
-.Fa tzp
is
.Dv NULL ,
-the associated time
-information will not be returned or set.
-.Pp
-The structures pointed to by
+the time will not be returned or set.
+The structure pointed to by
.Fa tp
-and
-.Fa tzp
-are defined in
+is defined in
.In sys/time.h
as:
.Bd -literal
@@ -80,22 +68,34 @@ struct timeval {
time_t tv_sec; /* seconds since Jan. 1, 1970 */
suseconds_t tv_usec; /* and microseconds */
};
-
-struct timezone {
- int tz_minuteswest; /* of Greenwich */
- int tz_dsttime; /* type of dst correction to apply */
-};
.Ed
.Pp
The
-.Fa 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.
+.Fa tzp
+parameter is historical and timezone information is no longer
+tracked by the system.
+All code should pass
+.Dv NULL
+for
+.Fa tzp .
+For
+.Fn gettimeofday ,
+if
+.Fa tzp
+is
+.Pf non- Dv NULL
+an empty
+.Dv timezone
+structure will be returned.
+For
+.Fn settimeofday ,
+if
+.Fa tzp
+is
+.Pf non- Dv NULL
+its contents are ignored.
.Pp
-Only the superuser may set the time of day or time zone.
+Only the superuser may set the time of day.
If the system securelevel is greater than 1 (see
.Xr init 8 ) ,
the time may only be advanced.