diff --git a/server/include/timing.h b/server/include/timing.h index f8061182b..88711a3b3 100644 --- a/server/include/timing.h +++ b/server/include/timing.h @@ -48,10 +48,4 @@ double time_to_double(struct timespec *ts); /** Convert double containing seconds after 1970 to timespec. */ struct timespec time_from_double(double secs); -/** Read a timestamp from a file with the format: "secs.nanosecs\t" */ -int time_fscan(FILE *f, struct timespec *ts); - -/** Write a timestamp to a file with the format: "secs.nanosecs\t" */ -int time_fprint(FILE *f, struct timespec *ts); - #endif /* _TIMING_H_ */ \ No newline at end of file diff --git a/server/src/file.c b/server/src/file.c index 2aab7cf13..ebee537a3 100644 --- a/server/src/file.c +++ b/server/src/file.c @@ -107,12 +107,14 @@ int file_open(struct node *n) serror("Failed to start timer"); } else { + struct msg m; /* Get current time */ struct timespec now, tmp; clock_gettime(CLOCK_REALTIME, &now); /* Get timestamp of first sample */ - time_fscan(f->in, &f->start); rewind(f->in); + msg_fscan(f->in, &m, NULL, NULL); + first = MSG_TS(&m); /* Set offset depending on epoch_mode */ switch (f->epoch_mode) { diff --git a/server/src/timing.c b/server/src/timing.c index 1e063f4cf..b0ae18a93 100644 --- a/server/src/timing.c +++ b/server/src/timing.c @@ -81,14 +81,4 @@ double time_delta(struct timespec *start, struct timespec *end) struct timespec diff = time_diff(start, end); return time_to_double(&diff); -} - -int time_fscan(FILE *f, struct timespec *ts) -{ - return fscanf(f, "%lu.%lu", &ts->tv_sec, &ts->tv_nsec); -} - -int time_fprint(FILE *f, struct timespec *ts) -{ - return fprintf(f, "%lu.%09lu\t", ts->tv_sec, ts->tv_nsec); -} +} \ No newline at end of file