equal
deleted
inserted
replaced
4 */ |
4 */ |
5 |
5 |
6 #include <stdio.h> |
6 #include <stdio.h> |
7 #include <stdlib.h> |
7 #include <stdlib.h> |
8 #include <string.h> |
8 #include <string.h> |
9 #include <math.h> |
|
10 #include <time.h> |
9 #include <time.h> |
11 #include <errno.h> |
10 #include <errno.h> |
12 |
11 |
13 void usage (char *name) |
12 void usage (char *name) |
14 { |
13 { |
18 |
17 |
19 time_t parse (char *buf) |
18 time_t parse (char *buf) |
20 { |
19 { |
21 time_t sec = 0; |
20 time_t sec = 0; |
22 time_t milli = 0; |
21 time_t milli = 0; |
23 double value; |
|
24 |
22 |
25 if (sscanf (buf, "%ld.%ld", &sec, &milli) != 2) { |
23 if (sscanf (buf, "%ld.%ld", &sec, &milli) != 2) { |
26 fprintf (stderr, " sec: %ld, ", sec); |
24 fprintf (stderr, " sec: %ld, ", sec); |
27 fprintf (stderr, "milli: %ld\n", milli); |
25 fprintf (stderr, "milli: %ld\n", milli); |
28 } |
26 } |
29 |
27 |
30 value = (milli / 1000000); |
28 return sec; |
31 return sec + (time_t) (floor (value)); |
|
32 } |
29 } |
33 |
30 |
34 time_t getboottime () |
31 time_t getboottime () |
35 { |
32 { |
36 char buf[80]; |
33 char buf[80]; |