summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libc/sys/gettimeofday.262
-rw-r--r--sys/kern/kern_time.c8
2 files changed, 35 insertions, 35 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.
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 8f1197b7935..31934323f71 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.123 2019/08/03 22:53:45 cheloha Exp $ */
+/* $OpenBSD: kern_time.c,v 1.124 2019/09/04 14:27:55 cheloha Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -323,6 +323,7 @@ sys_gettimeofday(struct proc *p, void *v, register_t *retval)
syscallarg(struct timezone *) tzp;
} */ *uap = v;
struct timeval atv;
+ static const struct timezone zerotz = { 0, 0 };
struct timeval *tp;
struct timezone *tzp;
int error = 0;
@@ -341,7 +342,7 @@ sys_gettimeofday(struct proc *p, void *v, register_t *retval)
#endif
}
if (tzp)
- error = copyout(&tz, tzp, sizeof (tz));
+ error = copyout(&zerotz, tzp, sizeof(zerotz));
return (error);
}
@@ -377,8 +378,7 @@ sys_settimeofday(struct proc *p, void *v, register_t *retval)
if ((error = settime(&ts)) != 0)
return (error);
}
- if (tzp)
- tz = atz;
+
return (0);
}