libc: add clock_settime() system call.

This also adds the sys_settime() kernel call which allows for the adjusting
of the clock named realtime in the kernel. The existing sys_stime()
function is still needed for a separate job (setting the boottime). The
boottime is set in the readclock driver. The sys_settime() interface is
meant to be flexible and will support both clock_settime() and adjtime()
when adjtime() is implemented later.

settimeofday() was adjusted to use the clock_settime() interface.

One side note discovered during testing: uptime(1) (part of the last(1)),
uses wtmp to determine boottime (not Minix's times(2)). This leads `uptime`
to report odd results when you set the time to a time prior to boottime.
This isn't a new bug introduced by my changes. It's been there for a while.
This commit is contained in:
Thomas Cort
2013-04-04 15:04:54 +02:00
committed by Ben Gras
parent 18ad4c0799
commit 516fec97d9
24 changed files with 179 additions and 11 deletions
+8
View File
@@ -19,6 +19,7 @@
* loop, there are several other minor entry points:
* clock_stop: called just before MINIX shutdown
* get_realtime: get wall time since boot in clock ticks
* set_realtime: set wall time since boot in clock ticks
* get_monotonic: get monotonic time since boot in clock ticks
* set_timer: set a watchdog timer (+)
* reset_timer: reset a watchdog timer (+)
@@ -167,6 +168,13 @@ clock_t get_realtime(void)
return(realtime);
}
/*===========================================================================*
* set_realtime *
*===========================================================================*/
void set_realtime(clock_t newrealtime)
{
realtime = newrealtime;
}
/*===========================================================================*
* get_monotonic *