# PosixClock Class Reference

A Clock implemented using POSIX clock_xxxxx API. More...

`#include <PosixClock.hh>`

Inheritance diagram for PosixClock:

[legend]

List of all members.

## Public Member Functions
| PosixClock (clockid_t newClockId=CLOCK_REALTIME)
| Build a POSIX clock using clock id.
virtual double | getResolution ()
| Get the clock resolution in nano-seconds.
virtual uint64_t | getCurrentTicksValue ()
| Get the current ticks value.
virtual double | tick2NanoSecond (const uint64_t ticks)
| Convert a number of ticks into a double value representing nanoseconds.
virtual | ~PosixClock ()
## Private Attributes
struct timespec | resolution
clockid_t | clockId

## Detailed Description

A Clock implemented using POSIX clock_xxxxx API.

Definition at line 12 of file PosixClock.hh.

## Constructor & Destructor Documentation

PosixClock | ( | clockid_t | newClockId = `CLOCK_REALTIME` | ) |

Build a POSIX clock using clock id.

Parameters:

  `[in]` | clockId | the POSIX clock identifier which may be CLOCK_REALTIME (default value) CLOCK_MONOTONIC CLOCK_PROCESS_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID CLOCK_REALTIME_HR CLOCK_MONOTONIC_HR

Definition at line 7 of file PosixClock.cc.

References PosixClock::clockId, and PosixClock::resolution.

~PosixClock | ( |  | ) | `[virtual]`

Definition at line 30 of file PosixClock.cc.

## Member Function Documentation

double getResolution | ( |  | ) | `[virtual]`

Get the clock resolution in nano-seconds.

Returns:
  the clock resolution in nano-seconds

Implements Clock.

Definition at line 14 of file PosixClock.cc.

References PosixClock::resolution.

uint64_t getCurrentTicksValue | ( |  | ) | `[virtual]`

Get the current ticks value.

Returns:
  the current ticks value

Implements Clock.

Definition at line 18 of file PosixClock.cc.

References PosixClock::clockId.

double tick2NanoSecond | ( | const uint64_t | ticks | ) | `[virtual]`

Convert a number of ticks into a double value representing nanoseconds.

Parameters:

  `[in]` | ticks | the number of tick to convert

Returns:
  the nano-seconds value

Implements Clock.

Definition at line 26 of file PosixClock.cc.

## Member Data Documentation

struct timespec resolution`[read, private]`

Definition at line 45 of file PosixClock.hh.

Referenced by PosixClock::getResolution(), and PosixClock::PosixClock().

clockid_t clockId`[private]`

Definition at line 46 of file PosixClock.hh.

Referenced by PosixClock::getCurrentTicksValue(), and PosixClock::PosixClock().

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

- PosixClock.hh
- PosixClock.cc