1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

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 <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-05-24 17:44:35 +08:00
parent 92b0d8a614
commit 3a42fb545a

View file

@ -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;