LogCabin
Classes | Namespaces | Typedefs | Functions | Variables
Core/Time.h File Reference
#include <cassert>
#include <chrono>
#include <iostream>
#include <time.h>
#include "Core/StringUtil.h"

Go to the source code of this file.

Classes

struct  LogCabin::Core::Time::CSystemClock
 Wall clock in nanosecond granularity. More...
struct  LogCabin::Core::Time::CSteadyClock
 Monotonic clock in nanosecond granularity. More...
struct  LogCabin::Core::Time::MockableClock< _BaseClock >
 Reads the current time. More...
struct  LogCabin::Core::Time::MockableClock< _BaseClock >::Mocker
 RAII class to mock out the clock and then restore it. More...
class  LogCabin::Core::Time::SteadyTimeConverter
 Used to convert one or more SteadyClock::time_point values into values of the SystemClock. More...

Namespaces

namespace  LogCabin
namespace  LogCabin::Core
namespace  LogCabin::Core::Time
namespace  std

Typedefs

typedef MockableClock
< std::chrono::steady_clock > 
LogCabin::Core::Time::SteadyClock
 The best available clock on this system for uses where a steady, monotonic clock is desired.
typedef MockableClock
< std::chrono::system_clock > 
LogCabin::Core::Time::SystemClock
 A clock that reads wall time and is affected by NTP adjustments.

Functions

template<typename Clock , typename Duration >
struct timespec LogCabin::Core::Time::makeTimeSpec (const std::chrono::time_point< Clock, Duration > &when)
 Convert a C++11 time point into a POSIX timespec.
int64_t LogCabin::Core::Time::parseSignedDuration (const std::string &description)
 Convert a human-readable description of a time duration into a number of nanoseconds.
uint64_t LogCabin::Core::Time::parseNonNegativeDuration (const std::string &description)
 Convert a human-readable description of a time duration into a number of nanoseconds.
static __inline uint64_t LogCabin::Core::Time::rdtsc ()
 Read the CPU's cycle counter.
void LogCabin::Core::Time::sleep (SteadyClock::time_point wake)
 Block the calling thread until the given time.
void LogCabin::Core::Time::sleep (std::chrono::nanoseconds duration)
 Block the calling thread for the given duration.
std::ostream & std::operator<< (std::ostream &os, const std::chrono::nanoseconds &duration)
std::ostream & std::operator<< (std::ostream &os, const std::chrono::microseconds &duration)
std::ostream & std::operator<< (std::ostream &os, const std::chrono::milliseconds &duration)
std::ostream & std::operator<< (std::ostream &os, const std::chrono::seconds &duration)
std::ostream & std::operator<< (std::ostream &os, const std::chrono::minutes &duration)
std::ostream & std::operator<< (std::ostream &os, const std::chrono::hours &duration)
template<typename Clock , typename Duration >
std::ostream & std::operator<< (std::ostream &os, const std::chrono::time_point< Clock, Duration > &timePoint)
 Prints std::time_point values in a way that is useful for unit tests.

Variables

const clockid_t LogCabin::Core::Time::STEADY_CLOCK_ID
 The clock used by CSteadyClock.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines