mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
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>
41 lines
781 B
C++
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;
|
|
}
|