Adds the sdi_toolBox library (temporary version)
This commit is contained in:
55
sdi_toolBox_1.0.x/toolBox/sdi_toolBox/dateTime/timer.h
Normal file
55
sdi_toolBox_1.0.x/toolBox/sdi_toolBox/dateTime/timer.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
{{copyright}}
|
||||
*/
|
||||
|
||||
/*
|
||||
{{version}}
|
||||
*/
|
||||
|
||||
/*
|
||||
{{license}}
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "iTimer.h"
|
||||
|
||||
namespace sdi_toolBox::dateTime
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
/**
|
||||
* @brief Standard timer implementation using std::chrono.
|
||||
*
|
||||
* Implements ITimer using std::chrono::high_resolution_clock for
|
||||
* high-precision timing in standard C++ environments.
|
||||
*/
|
||||
class Timer : public ITimer
|
||||
{
|
||||
public:
|
||||
Timer(); // Default constructor
|
||||
~Timer() = default; // Default destructor
|
||||
Timer(const Timer &obj) = default; // Copy constructor
|
||||
Timer(Timer &&obj) noexcept = default; // Move constructor
|
||||
Timer &operator=(const Timer &obj) = default; // Copy assignment operator
|
||||
Timer &operator=(Timer &&obj) noexcept = default; // Move assignment operator
|
||||
|
||||
/**
|
||||
* @brief Returns the current time point using std::chrono::high_resolution_clock.
|
||||
* @return The current time point.
|
||||
*/
|
||||
[[nodiscard]] TimePoint now() const override;
|
||||
};
|
||||
//--------------------------------------------------------------
|
||||
/* Default constructor */
|
||||
inline Timer::Timer()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
/* Get the current timepoint */
|
||||
inline Timer::TimePoint Timer::now() const
|
||||
{
|
||||
return Clock::now();
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
} // namespace sdi_toolBox::dateTime
|
||||
Reference in New Issue
Block a user