mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include <chrono>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -47,6 +48,11 @@ public:
|
||||
Timespan(const Timespan& timespan);
|
||||
/// Creates a Timespan from another one.
|
||||
|
||||
template <class T, class Period>
|
||||
Timespan(const std::chrono::duration<T, Period>& dtime) :
|
||||
_span(std::chrono::duration_cast<std::chrono::microseconds>(dtime).count()) {}
|
||||
/// Creates a Timespan from std::chrono::duration
|
||||
|
||||
~Timespan();
|
||||
/// Destroys the Timespan.
|
||||
|
||||
@@ -63,6 +69,14 @@ public:
|
||||
/// Assigns a new span. Useful for assigning
|
||||
/// from a struct timeval.
|
||||
|
||||
template <class T, class Period>
|
||||
Timespan& assign(const std::chrono::duration<T, Period>& dtime)
|
||||
/// Assigns a new span from std::chrono::duration.
|
||||
{
|
||||
_span = std::chrono::duration_cast<std::chrono::microseconds>(dtime).count();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(Timespan& timespan);
|
||||
/// Swaps the Timespan with another one.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user