Bug-AGL: SPEC-1296
Bug-AGL: SPEC-1293
Change-Id: I77ccb79975c6f2ac1a276031d9fd1c03839c3b91
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
#define _MAXEXP_ ((time_t)(~(time_t)0))
#define _MAXEXP2_ ((time_t)((((unsigned long long)_MAXEXP_) >> 1)))
#define MAX_EXPIRATION (_MAXEXP_ >= 0 ? _MAXEXP_ : _MAXEXP2_)
-#define NOW (time(NULL))
+#define NOW (time_now())
struct cookie
{
char initok[SIZEUUID];
} sessions;
+/* Get the actual raw time */
+static inline time_t time_now()
+{
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+ return ts.tv_sec;
+}
+
/* generate a uuid */
static void new_uuid(char uuid[SIZEUUID])
{