NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::time::system_clock Class Reference

System clock. More...

#include <time.hpp>

Public Types

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

Static Public Member Functions

static time_point now () noexcept
static std::time_t to_time_t (const time_point &t) noexcept
static time_point from_time_t (std::time_t 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:

const auto now = system_clock::now();

To convert a time_point to/from UNIX timestamp:

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

Definition at line 194 of file time.hpp.

Member Typedef Documentation

◆ duration

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

Definition at line 197 of file time.hpp.

◆ rep

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

Definition at line 198 of file time.hpp.

◆ period

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

Definition at line 199 of file time.hpp.

◆ time_point

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

Definition at line 200 of file time.hpp.

◆ TimePoint

Definition at line 203 of file time.hpp.

◆ Duration

Definition at line 204 of file time.hpp.

Member Function Documentation

◆ now()

◆ to_time_t()

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

Definition at line 58 of file time.cpp.

◆ from_time_t()

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

Definition at line 64 of file time.cpp.

Member Data Documentation

◆ is_steady

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

Definition at line 201 of file time.hpp.

The documentation for this class was generated from the following files: