sync to keep working
This commit is contained in:
parent
236cdd5ef7
commit
e267a0d2ed
12 changed files with 154 additions and 89 deletions
|
@ -11,18 +11,18 @@ set(hdrs
|
|||
include/pw/core/serialize.hpp
|
||||
include/pw/core/image.hpp
|
||||
include/pw/core/point.hpp
|
||||
include/pw/core/rect.hpp
|
||||
include/pw/core/size.hpp
|
||||
include/pw/core/rect.hpp
|
||||
include/pw/core/size.hpp
|
||||
include/pw/core/timer.hpp
|
||||
include/pw/core/mesh.hpp
|
||||
include/pw/core/mesh.hpp
|
||||
include/pw/core/globals.hpp
|
||||
)
|
||||
|
||||
set(srcs
|
||||
src/buffer.cpp
|
||||
src/buffer.cpp
|
||||
src/image.cpp
|
||||
src/debug.cpp
|
||||
src/mesh.cpp
|
||||
src/mesh.cpp
|
||||
src/core.cpp
|
||||
src/serialize.cpp
|
||||
src/timer.cpp
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef PW_CORE_TIMER_HPP_
|
||||
#define PW_CORE_TIMER_HPP_
|
||||
|
||||
|
||||
#include <pw/core/globals.hpp>
|
||||
|
||||
#include <chrono>
|
||||
|
@ -36,10 +35,6 @@ namespace pw {
|
|||
class timer {
|
||||
public:
|
||||
|
||||
const static unsigned int UnitMicroSeconds = 1000000;
|
||||
const static unsigned int UnitMilliSeconds = 1000;
|
||||
const static unsigned int UnitSeconds = 1;
|
||||
|
||||
typedef std::chrono::time_point<std::chrono::high_resolution_clock> tick_t;
|
||||
|
||||
timer(); /// c'tor
|
||||
|
@ -49,17 +44,15 @@ public:
|
|||
|
||||
/**
|
||||
* @brief elapsed time based on the scale
|
||||
* @param scale units the time will be reported
|
||||
* @return value of the time since last @see reset
|
||||
*/
|
||||
double elapsed(unsigned int scale = UnitMilliSeconds) const;
|
||||
double elapsed() const;
|
||||
|
||||
/**
|
||||
* @brief Now
|
||||
* @param scale
|
||||
* @return
|
||||
* @brief time from start of core in seconds
|
||||
* @return time in seconds
|
||||
*/
|
||||
static double now(unsigned int scale = UnitMicroSeconds);
|
||||
static double now();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -1,13 +1,27 @@
|
|||
/* vim: set tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab */
|
||||
/*
|
||||
* SSTT - Simplified Spatial Target Tracker
|
||||
* Copyright (c) 1999-2019 Hartmut Seichter
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* (c) Copyrights 2007-2018 Hartmut Seichter
|
||||
*/
|
||||
|
||||
#include "pw/core/timer.hpp"
|
||||
|
||||
|
||||
namespace pw {
|
||||
|
||||
static timer global_timer;
|
||||
|
@ -26,15 +40,15 @@ void timer::reset()
|
|||
_start = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
double timer::elapsed( unsigned int scale ) const
|
||||
double timer::elapsed() const
|
||||
{
|
||||
std::chrono::duration<double> elapsed_seconds = std::chrono::high_resolution_clock::now() - _start;
|
||||
return elapsed_seconds.count() * scale;
|
||||
return elapsed_seconds.count();
|
||||
}
|
||||
|
||||
double timer::now( unsigned int scale )
|
||||
double timer::now()
|
||||
{
|
||||
return global_timer.elapsed(scale);
|
||||
return global_timer.elapsed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue