1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibGUI: Fix broken doubleclick detection due to uninitialized GElapsedTimer.

This commit is contained in:
Andreas Kling 2019-04-01 22:03:32 +02:00
parent ee4d7c18c8
commit c9b0d87927
4 changed files with 17 additions and 3 deletions

View file

@ -1,8 +1,10 @@
#include <LibGUI/GElapsedTimer.h>
#include <AK/Assertions.h>
#include <sys/time.h>
void GElapsedTimer::start()
{
m_valid = true;
gettimeofday(&m_start_time, nullptr);
}
@ -18,6 +20,7 @@ inline void timersub(const struct timeval* a, const struct timeval* b, struct ti
int GElapsedTimer::elapsed() const
{
ASSERT(is_valid());
struct timeval now;
gettimeofday(&now, nullptr);
struct timeval diff;