From 3a42fb545a822875135689511beac1d3e88f6b7b Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 24 May 2016 17:44:35 +0800 Subject: [PATCH] update discard pre 2016 date if post 2016 date seen Otherwise lwsws started at boot on a system without an RTC may feel it was started in 1970, and when the clock is set by ntpd a little later, has been up for 16,000 days... Signed-off-by: Andy Green --- lib/service.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/service.c b/lib/service.c index 8ef82155..94afda98 100644 --- a/lib/service.c +++ b/lib/service.c @@ -675,6 +675,13 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int t time(&now); + /* + * handle case that system time was uninitialized when lws started + * at boot, and got initialized a little later + */ + if (context->time_up < 1464083026 && now > 1464083026) + context->time_up = now; + /* TODO: if using libev, we should probably use timeout watchers... */ if (context->last_timeout_check_s != now) { context->last_timeout_check_s = now;