From c9bc5a8cd809635c99f6301cdb34ae2ffbfa308c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 31 Jan 2018 14:33:20 -0500 Subject: [PATCH] if given timestamp is in the future, reset it, it is likely invalid --- src/zm_event.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 5beaa00a8..c37bd04ce 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -60,10 +60,16 @@ Event::Event( std::string notes; createNotes(notes); + struct timeval now; + gettimeofday(&now, 0); + bool untimedEvent = false; if ( !start_time.tv_sec ) { untimedEvent = true; - gettimeofday(&start_time, 0); + start_time = now; + } else if ( start_time.tv_sec > now.tv_sec ) { + Error("StartTime in the future"); + start_time = now; } Storage * storage = monitor->getStorage();