Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_time.c
Show First 20 Lines • Show All 654 Lines • ▼ Show 20 Lines | sys_gettimeofday(struct thread *td, struct gettimeofday_args *uap) | ||||
struct timezone rtz; | struct timezone rtz; | ||||
int error = 0; | int error = 0; | ||||
if (uap->tp) { | if (uap->tp) { | ||||
microtime(&atv); | microtime(&atv); | ||||
error = copyout(&atv, uap->tp, sizeof (atv)); | error = copyout(&atv, uap->tp, sizeof (atv)); | ||||
} | } | ||||
if (error == 0 && uap->tzp != NULL) { | if (error == 0 && uap->tzp != NULL) { | ||||
rtz.tz_minuteswest = tz_minuteswest; | rtz.tz_minuteswest = 0; | ||||
rtz.tz_dsttime = tz_dsttime; | rtz.tz_dsttime = 0; | ||||
error = copyout(&rtz, uap->tzp, sizeof (rtz)); | error = copyout(&rtz, uap->tzp, sizeof (rtz)); | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct settimeofday_args { | struct settimeofday_args { | ||||
struct timeval *tv; | struct timeval *tv; | ||||
Show All 34 Lines | kern_settimeofday(struct thread *td, struct timeval *tv, struct timezone *tzp) | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
/* Verify all parameters before changing time. */ | /* Verify all parameters before changing time. */ | ||||
if (tv) { | if (tv) { | ||||
if (tv->tv_usec < 0 || tv->tv_usec >= 1000000 || | if (tv->tv_usec < 0 || tv->tv_usec >= 1000000 || | ||||
tv->tv_sec < 0) | tv->tv_sec < 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
error = settime(td, tv); | error = settime(td, tv); | ||||
} | |||||
if (tzp && error == 0) { | |||||
tz_minuteswest = tzp->tz_minuteswest; | |||||
tz_dsttime = tzp->tz_dsttime; | |||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Get value of an interval timer. The process virtual and profiling virtual | * Get value of an interval timer. The process virtual and profiling virtual | ||||
* time timers are kept in the p_stats area, since they can be swapped out. | * time timers are kept in the p_stats area, since they can be swapped out. | ||||
* These are kept internally in the way they are specified externally: in | * These are kept internally in the way they are specified externally: in | ||||
▲ Show 20 Lines • Show All 1,039 Lines • Show Last 20 Lines |