40 #include "sys/clock.h"
49 struct timetable_timestamp *
50 timetable_entry(
struct timetable *t,
int num)
55 return &(t->timestamps[num]);
59 timetable_ptr(
struct timetable *t)
65 timetable_clear(
struct timetable *t)
71 timetable_timediff(
struct timetable *t,
72 const char *id1,
const char *id2)
83 for(i = *t->ptr - 1; i >= 0; --i) {
84 if(t->timestamps[i].id == id1) {
90 for(i = i - 1; i >= 0; --i) {
91 if(t->timestamps[i].id == id2) {
96 if(t1 != t->size && t2 != t->size) {
97 return t->timestamps[t1].time - t->timestamps[t2].time;
108 TIMETABLE_STATIC(temp);
110 timetable_clear(&temp);
113 TIMETABLE_TIMESTAMP(temp, &dummy1);
114 TIMETABLE_TIMESTAMP(temp, &dummy2);
119 timetable_print(
struct timetable *t)
124 time = t->timestamps[0].time;
127 for(i = 1; i < *t->ptr; ++i) {
128 printf(
"%s: %u\n", t->timestamps[i - 1].id, t->timestamps[i].time - time);
129 time = t->timestamps[i].time;