Libosmium
2.7.2
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <timestamp.hpp>
Public Member Functions | |
constexpr | Timestamp () noexcept |
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 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... | |
OSMIUM_DEPRECATED constexpr | operator time_t () const noexcept |
template<typename T > | |
void | operator+= (T time_difference) noexcept |
template<typename T > | |
void | operator-= (T time_difference) noexcept |
std::string | to_iso () const |
Static Private Member Functions | |
static const char * | timestamp_format () |
Private Attributes | |
uint32_t | m_timestamp |
Static Private Attributes | |
static constexpr int | timestamp_length = 20 + 1 |
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.
|
inlinenoexcept |
Default construct an invalid Timestamp.
|
inlinenoexcept |
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. |
|
inlineexplicitnoexcept |
Explicit conversion into bool.
|
inlinenoexcept |
Implicit conversion into time_t.
|
inlineexplicitnoexcept |
Explicit conversion into uint32_t.
|
inlineexplicitnoexcept |
Explicit conversion into uint64_t.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Explicit conversion into time_t.
|
inlinestaticprivate |
|
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.
|
inlinenoexcept |
Returns true if this timestamp is valid (ie set to something other than 0).
|
private |
|
staticprivate |