aboutsummaryrefslogtreecommitdiff
path: root/libbb/atlas_timesync.c
blob: 3434493857f7742137cc255922266573e6077c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * Copyright (c) 2013 RIPE NCC <atlas@ripe.net>
 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
 */

#include "libbb.h"
int get_timesync(void)
{
	FILE *fh;
	int lastsync;

	fh= fopen(ATLAS_TIMESYNC_FILE, "r");
	if (!fh)
		return -1;
	fscanf(fh, "%d", &lastsync);
	fclose(fh);
	return time(NULL)-lastsync;
}