xref: /csrg-svn/sys/kern/kern_time.c (revision 7500)
1 /*	kern_time.c	5.2	82/07/24	*/
2 
3 #include "../h/param.h"
4 #include "../h/systm.h"
5 #include "../h/dir.h"
6 #include "../h/user.h"
7 #include "../h/reg.h"
8 #include "../h/inode.h"
9 #include "../h/proc.h"
10 #include "../h/clock.h"
11 #include "../h/mtpr.h"
12 #include "../h/timeb.h"
13 #include "../h/times.h"
14 #include "../h/reboot.h"
15 #include "../h/fs.h"
16 #include "../h/conf.h"
17 #include "../h/buf.h"
18 #include "../h/mount.h"
19 
20 rtime()
21 {
22 
23 }
24 
25 rusage()
26 {
27 
28 }
29 
30 itimer()
31 {
32 
33 }
34 
35 /* BEGIN DEPRECATED */
36 ogtime()
37 {
38 
39 	u.u_r.r_time = time;
40 	if (clkwrap())
41 		clkset();
42 }
43 
44 /*
45  * New time entry-- return TOD with milliseconds, timezone,
46  * DST flag
47  */
48 oftime()
49 {
50 	register struct a {
51 		struct	timeb	*tp;
52 	} *uap;
53 	struct timeb t;
54 	register unsigned ms;
55 
56 	uap = (struct a *)u.u_ap;
57 	(void) spl7();
58 	t.time = time;
59 	ms = lbolt;
60 	(void) spl0();
61 	if (ms > hz) {
62 		ms -= hz;
63 		t.time++;
64 	}
65 	t.millitm = (1000*ms)/hz;
66 	t.timezone = timezone;
67 	t.dstflag = dstflag;
68 	if (copyout((caddr_t)&t, (caddr_t)uap->tp, sizeof(t)) < 0)
69 		u.u_error = EFAULT;
70 	if (clkwrap())
71 		clkset();
72 }
73 /* END DEPRECATED */
74 
75 /*
76  * Set the time
77  */
78 stime()
79 {
80 	register struct a {
81 		time_t	time;
82 	} *uap;
83 
84 	uap = (struct a *)u.u_ap;
85 	if (suser()) {
86 		bootime += uap->time - time;
87 		time = uap->time;
88 		clkset();
89 	}
90 }
91 
92 times()
93 {
94 	register struct a {
95 		time_t	(*times)[4];
96 	} *uap;
97 	struct tms tms;
98 
99 	tms.tms_utime = u.u_vm.vm_utime;
100 	tms.tms_stime = u.u_vm.vm_stime;
101 	tms.tms_cutime = u.u_cvm.vm_utime;
102 	tms.tms_cstime = u.u_cvm.vm_stime;
103 	uap = (struct a *)u.u_ap;
104 	if (copyout((caddr_t)&tms, (caddr_t)uap->times, sizeof(struct tms)) < 0)
105 		u.u_error = EFAULT;
106 }
107