10 time_parse(struct time_info
*ti
, char *s
)
13 case '_': ti
->period
= TT_TOTAL
; s
++; break;
14 default: ti
->period
= TT_MOVE
; break;
19 ti
->len
.games
= atoi(++s
);
24 ti
->dim
= TD_WALLTIME
;
25 ti
->len
.walltime
.tv_sec
= atoi(s
);
26 ti
->len
.walltime
.tv_nsec
= 0;
33 time_add(struct timespec
*when
, struct timespec
*len
)
35 when
->tv_sec
+= len
->tv_sec
;
36 when
->tv_nsec
+= len
->tv_nsec
;
37 if (when
->tv_nsec
> 1000000000)
38 when
->tv_sec
++, when
->tv_nsec
-= 1000000000;
42 time_passed(struct timespec
*when
)
44 struct timespec now
; clock_gettime(CLOCK_REALTIME
, &now
);
46 return now
.tv_sec
> when
->tv_sec
|| (now
.tv_sec
== when
->tv_sec
&& now
.tv_nsec
> when
->tv_nsec
);