Libosmium
2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <timestamp.hpp>
Public Member Functions | |
constexpr | Timestamp () noexcept=default |
template<typename T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0> | |
constexpr | Timestamp (T timestamp) noexcept |
Timestamp (const char *timestamp) | |
Timestamp (const std::string ×tamp) | |
bool | valid () const noexcept |
constexpr | operator bool () const noexcept |
Explicit conversion into bool. More... | |
constexpr std::time_t | seconds_since_epoch () const noexcept |
Explicit conversion into time_t. More... | |
constexpr | operator uint32_t () const noexcept |
Explicit conversion into uint32_t. More... | |
constexpr | operator uint64_t () const noexcept |
Explicit conversion into uint64_t. More... | |
template<typename T > | |
void | operator+= (T time_difference) noexcept |
template<typename T > | |
void | operator-= (T time_difference) noexcept |
std::string | to_iso () const |
std::string | to_iso_all () const |
Private Member Functions | |
void | to_iso_str (std::string &s) const |
Private Attributes | |
uint32_t | m_timestamp = 0 |
A timestamp. Internal representation is an unsigned 32bit integer holding seconds since epoch (1970-01-01T00:00:00Z), so this will overflow in 2106. We can use an unsigned integer here, because the OpenStreetMap project was started long after 1970, so there will never be dates before that.
|
constexprdefaultnoexcept |
Default construct an invalid Timestamp.
|
inlineconstexprnoexcept |
Construct a Timestamp from any integer type containing the seconds since the epoch. This will not check for overruns, you have to make sure the value fits into a uint32_t which is used internally in the Timestamp.
The constructor is not declared "explicit" so that conversions like
work.
|
inlineexplicit |
Construct timestamp from ISO date/time string in the format "yyyy-mm-ddThh:mm:ssZ".
std::invalid_argument | if the timestamp can not be parsed. |
|
inlineexplicit |
Construct timestamp from ISO date/time string in the format "yyyy-mm-ddThh:mm:ssZ".
std::invalid_argument | if the timestamp can not be parsed. |
|
inlineexplicitconstexprnoexcept |
Explicit conversion into bool.
|
inlineexplicitconstexprnoexcept |
Explicit conversion into uint32_t.
|
inlineexplicitconstexprnoexcept |
Explicit conversion into uint64_t.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Explicit conversion into time_t.
|
inline |
Return the timestamp as string in ISO date/time ("yyyy-mm-ddThh:mm:ssZ") format. If the timestamp is invalid, an empty string will be returned.
|
inline |
Return the timestamp as string in ISO date/time ("yyyy-mm-ddThh:mm:ssZ") format. If the timestamp is invalid, the string "1970-01-01T00:00:00Z" will be returned.
|
inlineprivate |
|
inlinenoexcept |
Returns true if this timestamp is valid (ie set to something other than 0).
|
private |