ndn::time::system_clock Class Reference

System clock. More...

#include <time.hpp>

Public Types

using duration = boost::chrono::system_clock::duration
 
typedef duration Duration
 
using period = duration::period
 
using rep = duration::rep
 
using time_point = boost::chrono::time_point< system_clock >
 
typedef time_point TimePoint
 

Static Public Member Functions

static time_point from_time_t (std::time_t t) noexcept
 
static time_point now () noexcept
 
static std::time_t to_time_t (const time_point &t) noexcept
 

Static Public Attributes

static constexpr bool is_steady = boost::chrono::system_clock::is_steady
 

Detailed Description

System clock.

System clock represents the system-wide real time wall clock.

It may not be monotonic: on most systems, the system time can be adjusted at any moment. It is the only clock that has the ability to be displayed and converted to/from UNIX timestamp.

To get the current time:

system_clock::TimePoint now = system_clock::now();

To convert a TimePoint to/from UNIX timestamp:

system_clock::TimePoint time = ...; uint64_t timestampInMilliseconds = toUnixTimestamp(time).count(); system_clock::TimePoint time2 = fromUnixTimestamp(milliseconds(timestampInMilliseconds));

Definition at line 187 of file time.hpp.

Member Typedef Documentation

using ndn::time::system_clock::duration = boost::chrono::system_clock::duration

Definition at line 190 of file time.hpp.

Definition at line 197 of file time.hpp.

using ndn::time::system_clock::period = duration::period

Definition at line 192 of file time.hpp.

using ndn::time::system_clock::rep = duration::rep

Definition at line 191 of file time.hpp.

using ndn::time::system_clock::time_point = boost::chrono::time_point<system_clock>

Definition at line 193 of file time.hpp.

Definition at line 196 of file time.hpp.

Member Function Documentation

system_clock::time_point ndn::time::system_clock::from_time_t ( std::time_t  t)
staticnoexcept

Definition at line 64 of file time.cpp.

system_clock::time_point ndn::time::system_clock::now ( )
staticnoexcept

Definition at line 46 of file time.cpp.

std::time_t ndn::time::system_clock::to_time_t ( const time_point t)
staticnoexcept

Definition at line 58 of file time.cpp.

Member Data Documentation

constexpr bool ndn::time::system_clock::is_steady = boost::chrono::system_clock::is_steady
static

Definition at line 194 of file time.hpp.