Vamp::RealTime Class Reference

`#include <vamp-sdk/RealTime.h>`

## Public Member Functions

int | usec () const
int | msec () const
| RealTime ()
| RealTime (int s, int n)
| RealTime (const RealTime &r)
RealTime & | operator= (const RealTime &r)
RealTime | operator+ (const RealTime &r) const
RealTime | operator- (const RealTime &r) const
RealTime | operator- () const
bool | operator< (const RealTime &r) const
bool | operator> (const RealTime &r) const
bool | operator== (const RealTime &r) const
bool | operator!= (const RealTime &r) const
bool | operator>= (const RealTime &r) const
bool | operator<= (const RealTime &r) const
RealTime | operator/ (int d) const
double | operator/ (const RealTime &r) const
| Return the ratio of two times. More...
std::string | toString () const
| Return a human-readable debug-type string to full precision (probably not a format to show to a user directly) More...
std::string | toText (bool fixedDp=false) const
| Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm. More...

## Static Public Member Functions

static RealTime | fromSeconds (double sec)
static RealTime | fromMilliseconds (int msec)
static RealTime | fromTimeval (const struct timeval &)
static long | realTime2Frame (const RealTime &r, unsigned int sampleRate)
| Convert a RealTime into a sample frame at the given sample rate. More...
static RealTime | frame2RealTime (long frame, unsigned int sampleRate)
| Convert a sample frame at the given sample rate into a RealTime. More...

## Public Attributes

int | sec
int | nsec

## Static Public Attributes

static const RealTime | zeroTime

## Detailed Description

RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions.

Definition at line 66 of file vamp-sdk/RealTime.h.

## Constructor & Destructor Documentation

## RealTime() [1/3]

Vamp::RealTime::RealTime | ( |  | ) |

inline

Definition at line 74 of file vamp-sdk/RealTime.h.

## RealTime() [2/3]

Vamp::RealTime::RealTime | ( | int | s,
|  | int | n
| ) |  |

## RealTime() [3/3]

Vamp::RealTime::RealTime | ( | const RealTime & | r | ) |

inline

Definition at line 77 of file vamp-sdk/RealTime.h.

## Member Function Documentation

## usec()

int Vamp::RealTime::usec | ( |  | ) | const

inline

Definition at line 71 of file vamp-sdk/RealTime.h.

## msec()

int Vamp::RealTime::msec | ( |  | ) | const

inline

Definition at line 72 of file vamp-sdk/RealTime.h.

## fromSeconds()

static RealTime Vamp::RealTime::fromSeconds | ( | double | sec | ) |

static

## fromMilliseconds()

static RealTime Vamp::RealTime::fromMilliseconds | ( | int | msec | ) |

static

## fromTimeval()

static RealTime Vamp::RealTime::fromTimeval | ( | const struct timeval & |  | ) |

static

## operator=()

RealTime& Vamp::RealTime::operator= | ( | const RealTime & | r | ) |

inline

Definition at line 87 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator+()

RealTime Vamp::RealTime::operator+ | ( | const RealTime & | r | ) | const

inline

Definition at line 91 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator-() [1/2]

RealTime Vamp::RealTime::operator- | ( | const RealTime & | r | ) | const

inline

Definition at line 94 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator-() [2/2]

RealTime Vamp::RealTime::operator- | ( |  | ) | const

inline

Definition at line 97 of file vamp-sdk/RealTime.h.

## operator<()

bool Vamp::RealTime::operator< | ( | const RealTime & | r | ) | const

inline

Definition at line 101 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator>()

bool Vamp::RealTime::operator> | ( | const RealTime & | r | ) | const

inline

Definition at line 106 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator==()

bool Vamp::RealTime::operator== | ( | const RealTime & | r | ) | const

inline

Definition at line 111 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator!=()

bool Vamp::RealTime::operator!= | ( | const RealTime & | r | ) | const

inline

Definition at line 115 of file vamp-sdk/RealTime.h.

## operator>=()

bool Vamp::RealTime::operator>= | ( | const RealTime & | r | ) | const

inline

Definition at line 119 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator<=()

bool Vamp::RealTime::operator<= | ( | const RealTime & | r | ) | const

inline

Definition at line 124 of file vamp-sdk/RealTime.h.

References nsec, and sec.

## operator/() [1/2]

RealTime Vamp::RealTime::operator/ | ( | int | d | ) | const

## operator/() [2/2]

double Vamp::RealTime::operator/ | ( | const RealTime & | r | ) | const

Return the ratio of two times.

## toString()

std::string Vamp::RealTime::toString | ( |  | ) | const

Return a human-readable debug-type string to full precision (probably not a format to show to a user directly)

Referenced by printFeatures().

## toText()

std::string Vamp::RealTime::toText | ( | bool | fixedDp = `false` | ) | const

Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm.

## realTime2Frame()

static long Vamp::RealTime::realTime2Frame | ( | const RealTime & | r,
|  | unsigned int | sampleRate
| ) |  |

static

Convert a RealTime into a sample frame at the given sample rate.

## frame2RealTime()

static RealTime Vamp::RealTime::frame2RealTime | ( | long | frame,
|  | unsigned int | sampleRate
| ) |  |

static

Convert a sample frame at the given sample rate into a RealTime.

Referenced by ZeroCrossing::process(), and PercussionOnsetDetector::process().

## Member Data Documentation

## sec

int Vamp::RealTime::sec

Definition at line 68 of file vamp-sdk/RealTime.h.

Referenced by operator+(), operator-(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and toSeconds().

## nsec

int Vamp::RealTime::nsec

Definition at line 69 of file vamp-sdk/RealTime.h.

Referenced by operator+(), operator-(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and toSeconds().

## zeroTime

const RealTime Vamp::RealTime::zeroTime

static

Definition at line 158 of file vamp-sdk/RealTime.h.

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

- vamp-sdk/RealTime.h