open62541++ 0.13.0
C++ wrapper of open62541
|
#include <DateTime.h>
UA_DateTime wrapper class.
An instance in time. A DateTime value is encoded as a 64-bit signed integer which represents the number of 100 nanosecond intervals since January 1, 1601 (UTC).
Definition at line 23 of file DateTime.h.
Public Types | |
using | DefaultClock = std::chrono::system_clock |
using | UaDuration = std::chrono::duration<int64_t, std::ratio<1, 10'000'000>> |
Public Types inherited from opcua::Wrapper< T > | |
using | NativeType = T |
Public Member Functions | |
template<typename Clock , typename Duration > | |
DateTime (std::chrono::time_point< Clock, Duration > timePoint) | |
template<typename Clock = DefaultClock, typename Duration = UaDuration> | |
std::chrono::time_point< Clock, Duration > | toTimePoint () const |
int64_t | toUnixTime () const noexcept |
UA_DateTimeStruct | toStruct () const noexcept |
int64_t | get () const noexcept |
std::string | format (std::string_view format, bool localtime=false) const |
constexpr | TypeWrapper ()=default |
constexpr | TypeWrapper (const T &native) |
constexpr | TypeWrapper (T &&native) noexcept |
constexpr | TypeWrapper (const TypeWrapper &other) |
constexpr | TypeWrapper (TypeWrapper &&other) noexcept |
Public Member Functions inherited from opcua::TypeWrapper< UA_DateTime, UA_TYPES_DATETIME > | |
constexpr | TypeWrapper ()=default |
constexpr | TypeWrapper (const UA_DateTime &native) |
constexpr | TypeWrapper (UA_DateTime &&native) noexcept |
constexpr | TypeWrapper (const TypeWrapper &other) |
constexpr | TypeWrapper (TypeWrapper &&other) noexcept |
~TypeWrapper () | |
constexpr TypeWrapper & | operator= (const TypeWrapper &other) |
constexpr TypeWrapper & | operator= (const UA_DateTime &native) |
constexpr TypeWrapper & | operator= (TypeWrapper &&other) noexcept |
constexpr TypeWrapper & | operator= (UA_DateTime &&native) noexcept |
constexpr void | swap (TypeWrapper &other) noexcept |
constexpr void | swap (UA_DateTime &native) noexcept |
Public Member Functions inherited from opcua::Wrapper< T > | |
constexpr | Wrapper ()=default |
constexpr | Wrapper (const T &native) |
constexpr | Wrapper (T &&native) noexcept |
constexpr | operator T& () noexcept |
constexpr | operator const T & () const noexcept |
constexpr T * | operator-> () noexcept |
constexpr const T * | operator-> () const noexcept |
constexpr T * | handle () noexcept |
constexpr const T * | handle () const noexcept |
Static Public Member Functions | |
static DateTime | now () noexcept |
template<typename Clock , typename Duration > | |
static DateTime | fromTimePoint (std::chrono::time_point< Clock, Duration > timePoint) |
static DateTime | fromUnixTime (int64_t unixTime) noexcept |
static int64_t | localTimeUtcOffset () noexcept |
Static Public Member Functions inherited from opcua::TypeWrapper< UA_DateTime, UA_TYPES_DATETIME > | |
static constexpr TypeIndex | getTypeIndex () |
Additional Inherited Members | |
Protected Member Functions inherited from opcua::TypeWrapper< UA_DateTime, UA_TYPES_DATETIME > | |
constexpr void | clear () noexcept |
Protected Member Functions inherited from opcua::Wrapper< T > | |
constexpr const T & | native () const noexcept |
constexpr T & | native () noexcept |
using opcua::DateTime::DefaultClock = std::chrono::system_clock |
Definition at line 25 of file DateTime.h.
using opcua::DateTime::UaDuration = std::chrono::duration<int64_t, std::ratio<1, 10'000'000>> |
Definition at line 26 of file DateTime.h.
|
inline |
Definition at line 31 of file DateTime.h.
|
inlinestaticnoexcept |
Get current DateTime.
Definition at line 35 of file DateTime.h.
|
inlinestatic |
Get DateTime from std::chrono::time_point.
Definition at line 41 of file DateTime.h.
Referenced by opcua::TypeConverter< std::chrono::time_point< Clock, Duration > >::toNative().
|
inlinestaticnoexcept |
Get DateTime from Unix time.
Definition at line 49 of file DateTime.h.
|
inlinestaticnoexcept |
Offset of local time to UTC.
Definition at line 54 of file DateTime.h.
|
inline |
Convert to std::chrono::time_point.
Definition at line 60 of file DateTime.h.
Referenced by opcua::TypeConverter< std::chrono::time_point< Clock, Duration > >::fromNative().
|
inlinenoexcept |
Convert to Unix time (number of seconds since January 1, 1970 UTC).
Definition at line 70 of file DateTime.h.
|
inlinenoexcept |
Convert to UA_DateTimeStruct.
Definition at line 78 of file DateTime.h.
|
inlinenoexcept |
Get DateTime value as 100 nanosecond intervals since January 1, 1601 (UTC).
Definition at line 83 of file DateTime.h.
Referenced by toStruct(), toTimePoint(), and toUnixTime().
std::string opcua::DateTime::format | ( | std::string_view | format, |
bool | localtime = false ) const |
Convert to string with given format (same format codes as strftime).
|
constexprdefault |
|
inlineexplicitconstexpr |
Constructor with native object (deep copy).
Definition at line 36 of file TypeWrapper.h.
|
inlineconstexprnoexcept |
Constructor with native object (move rvalue).
Definition at line 40 of file TypeWrapper.h.
|
inlineconstexpr |
Copy constructor (deep copy).
Definition at line 48 of file TypeWrapper.h.
|
inlineconstexprnoexcept |
Move constructor.
Definition at line 52 of file TypeWrapper.h.