Files
godot-angle-static/util/Timer.cpp
Jamie Madill 666fcf386f Rename functions that overlap with Windows APIs.
Bug: angleproject:6283
Change-Id: Ifcd9ea9e3bf729fd2066178eb9429050b2f10518
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3212894
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
2021-10-08 17:08:13 +00:00

41 lines
781 B
C++

//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Timer.cpp: Implementation of a high precision timer class.
//
#include "util/Timer.h"
#include "common/system_utils.h"
Timer::Timer() : mRunning(false), mStartTime(0), mStopTime(0) {}
void Timer::start()
{
mStartTime = angle::GetCurrentSystemTime();
mRunning = true;
}
void Timer::stop()
{
mStopTime = angle::GetCurrentSystemTime();
mRunning = false;
}
double Timer::getElapsedTime() const
{
double endTime;
if (mRunning)
{
endTime = angle::GetCurrentSystemTime();
}
else
{
endTime = mStopTime;
}
return endTime - mStartTime;
}