aboutsummaryrefslogtreecommitdiff
path: root/libbb/atlas_timesync.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/atlas_timesync.c')
-rw-r--r--libbb/atlas_timesync.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbb/atlas_timesync.c b/libbb/atlas_timesync.c
new file mode 100644
index 0000000..3434493
--- /dev/null
+++ b/libbb/atlas_timesync.c
@@ -0,0 +1,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;
+}
+