SOIL Time.
More...
#include <Time.h>
Speial Time class for SOIL to implement the necessary functionality.
Definition at line 12 of file Time.h.
◆ Time() [1/3]
Construct an uninitialized Time instance, where the _null
flag is set to true.
Definition at line 27 of file Time.cpp.
◆ Time() [2/3]
SOIL::Time::Time |
( |
std::string |
value | ) |
|
Constructs a Time object from an RFC3339 string. If an empty string is passed, the _null
flag is set to true.
The exceptions from the underlying boost implementation are passed through.
- Parameters
-
[in] | value | RFC3339 string of the time to set. |
Definition at line 31 of file Time.cpp.
◆ Time() [3/3]
SOIL::Time::Time |
( |
boost::posix_time::ptime |
value | ) |
|
Constructs a Time object from a boost::posix_time::ptime
. This is useful in conjuction with now()
.
- Parameters
-
Definition at line 46 of file Time.cpp.
◆ ~Time()
Default Destructor, there is no unexpected behaviour.
Definition at line 53 of file Time.cpp.
◆ is_null()
bool SOIL::Time::is_null |
( |
void |
| ) |
const |
|
inline |
Returns whether the time is set to null.
- Returns
Is Null?
Function that returns true if the current data is set to null and false else.
- Returns
- Null flag
Definition at line 92 of file Time.h.
◆ rfc3339()
std::string SOIL::Time::rfc3339 |
( |
void |
| ) |
const |
Return a RFC3339 conformant representation of the time, e.g. 2021-06-07T22:01:23.078162Z as string. This is the main time representation used in SOIL.
- Returns
- RFC3339 string
Definition at line 6 of file Time.cpp.
◆ serialize()
std::vector< unsigned char > SOIL::Time::serialize |
( |
void |
| ) |
const |
Bytewise serialization of the time for hashing purpose. The components are serialized in the following order:
- uint16_t of the year
- uint8_t of the month
- uint8_t of the day
- uint8_t of the hour
- uint8_t of the minute
- unit8_t of the seconds
- uint32_t of the nanoseconds
- Returns
- Serialized Bytestring
Definition at line 62 of file Time.cpp.
◆ set_null()
void SOIL::Time::set_null |
( |
bool |
_null = true | ) |
|
|
inline |
Function to set the null status of the data container
- Parameters
-
[in] | _null | Boolean state flag |
Definition at line 100 of file Time.h.
◆ utc_now()
boost::posix_time::ptime SOIL::Time::utc_now |
( |
void |
| ) |
|
|
static |
Returns the current UTC time as boost::posix_time::ptime
to allow for quick access in implementations using this library. Thanks to the corresponding constructor, this function can also be used in assignments.
- Returns
- Current UTC time
Definition at line 57 of file Time.cpp.
◆ operator<=
DLL bool operator<= |
( |
const Time & |
t1, |
|
|
const Time & |
t2 |
|
) |
| |
|
friend |
Friend declaration of the <= operator, needed for correcet implementation.
Lower or equal operation for two Time objects, which is needed for the correct implementation of the Range class.
Returns true if t1
<= t2
, otherwise false. If one of the Time objects is set to null, the operation returns false.
- Parameters
-
t1 | Left hand side time |
t2 | Right hand side time |
- Returns
- Comparison result as boolean
◆ operator>=
DLL bool operator>= |
( |
const Time & |
t1, |
|
|
const Time & |
t2 |
|
) |
| |
|
friend |
Friend declaration of the >= operator, needed for correcet implementation.
Greater or equal operation for two Time objects, which is needed for the correct implementation of the Range class.
Returns true if t1
>= t2
, otherwise false. If one of the Time objects is set to null, the operation returns false.
- Parameters
-
t1 | Left hand side time |
t2 | Right hand side time |
- Returns
- Comparison result as boolean
The documentation for this class was generated from the following files: