1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
diff -Naur csh-20230828/extern.h csh-20230828.patched/extern.h
--- csh-20230828/extern.h 2023-09-19 17:44:07.356219253 -0400
+++ csh-20230828.patched/extern.h 2023-09-19 18:07:32.732605839 -0400
@@ -276,6 +276,7 @@
void settimes(void);
void pcsecs(long);
void psecs(long);
+int timespec_gettimeofday(struct timespec *restrict, struct timezone *restrict);
/*
* alloc.c
diff -Naur csh-20230828/proc.c csh-20230828.patched/proc.c
--- csh-20230828/proc.c 2023-09-19 17:44:07.349219157 -0400
+++ csh-20230828.patched/proc.c 2023-09-19 18:06:05.785406431 -0400
@@ -121,7 +121,7 @@
}
else {
if (pp->p_flags & (PTIME | PPTIME) || adrof(STRtime))
- (void) gettimeofday(&pp->p_etime, NULL);
+ (void) timespec_gettimeofday(&pp->p_etime, NULL);
pp->p_rusage = ru;
@@ -507,7 +507,7 @@
}
pp->p_next = proclist.p_next;
proclist.p_next = pp;
- (void) gettimeofday(&pp->p_btime, NULL);
+ (void) timespec_gettimeofday(&pp->p_btime, NULL);
}
diff -Naur csh-20230828/time.c csh-20230828.patched/time.c
--- csh-20230828/time.c 2023-09-19 17:44:07.350219170 -0400
+++ csh-20230828.patched/time.c 2023-09-19 18:08:07.012078715 -0400
@@ -30,6 +30,7 @@
* SUCH DAMAGE.
*/
+#include <sys/time.h>
#include <sys/types.h>
#include <stdarg.h>
@@ -39,6 +40,20 @@
/*
* C Shell - routines handling process timing and niceing
*/
+
+int
+timespec_gettimeofday(struct timespec *restrict ts, struct timezone *restrict)
+{
+ int rv;
+ struct timeval tv;
+
+ rv = gettimeofday(&tv, NULL);
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = tv.tv_usec * 1000;
+
+ return rv;
+}
+
static void pdeltat(struct timeval *, struct timeval *);
void
@@ -46,7 +61,7 @@
{
struct rusage ruch;
- (void) gettimeofday(&time0, NULL);
+ (void) timespec_gettimeofday(&time0, NULL);
(void) getrusage(RUSAGE_SELF, &ru0);
(void) getrusage(RUSAGE_CHILDREN, &ruch);
ruadd(&ru0, &ruch);
@@ -65,7 +80,7 @@
(void) getrusage(RUSAGE_SELF, &ru1);
(void) getrusage(RUSAGE_CHILDREN, &ruch);
ruadd(&ru1, &ruch);
- (void) gettimeofday(&timedol, NULL);
+ (void) timespec_gettimeofday(&timedol, NULL);
prusage(&ru0, &ru1, &timedol, &time0);
}
|