ndn::time::system_clock Class Reference

System clock. More...

#include <ndn-cxx/util/time.hpp>

Public Types

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

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:

static time_point now() noexcept
Definition: time.cpp:45

To convert a time_point to/from UNIX timestamp:

auto timeInMilliseconds = time::toUnixTimestamp(t1).count();
::boost::chrono::time_point< system_clock > time_point
Definition: time.hpp:205
constexpr system_clock::time_point fromUnixTimestamp(system_clock::duration d)
Convert UNIX timestamp to system_clock::time_point.
Definition: time.hpp:274
constexpr Duration toUnixTimestamp(const system_clock::time_point &tp)
Convert system_clock::time_point to UNIX timestamp.
Definition: time.hpp:265
::boost::chrono::milliseconds milliseconds
Definition: time.hpp:52

Definition at line 199 of file time.hpp.

Member Typedef Documentation

◆ duration

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

Definition at line 202 of file time.hpp.

◆ period

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

Definition at line 204 of file time.hpp.

◆ rep

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

Definition at line 203 of file time.hpp.

◆ time_point

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

Definition at line 205 of file time.hpp.

Member Function Documentation

◆ from_time_t()

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

Definition at line 63 of file time.cpp.

◆ now()

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

Definition at line 45 of file time.cpp.

◆ to_time_t()

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

Definition at line 57 of file time.cpp.

Member Data Documentation

◆ is_steady

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

Definition at line 206 of file time.hpp.