44#ifndef _VAMP_REAL_TIME_H_
45#define _VAMP_REAL_TIME_H_
71 int usec()
const {
return nsec / 1000; }
72 int msec()
const {
return nsec / 1000000; }
78 sec(r.sec), nsec(r.nsec) { }
88 sec = r.
sec; nsec = r.
nsec;
return *
this;
102 if (sec == r.
sec)
return nsec < r.
nsec;
103 else return sec < r.
sec;
107 if (sec == r.
sec)
return nsec > r.
nsec;
108 else return sec > r.
sec;
112 return (sec == r.
sec && nsec == r.
nsec);
116 return !(r == *
this);
120 if (sec == r.
sec)
return nsec >= r.
nsec;
121 else return sec >= r.
sec;
125 if (sec == r.
sec)
return nsec <= r.
nsec;
126 else return sec <= r.
sec;
146 std::string
toText(
bool fixedDp =
false)
const;
std::ostream & operator<<(std::ostream &out, const RealTime &rt)
#define _VAMP_SDK_PLUGSPACE_BEGIN(h)
#define _VAMP_SDK_PLUGSPACE_END(h)
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...
bool operator<=(const RealTime &r) const
std::string toString() const
Return a human-readable debug-type string to full precision (probably not a format to show to a user ...
RealTime & operator=(const RealTime &r)
double operator/(const RealTime &r) const
Return the ratio of two times.
std::string toText(bool fixedDp=false) const
Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm.
static RealTime fromMilliseconds(int msec)
bool operator!=(const RealTime &r) const
static RealTime fromTimeval(const struct timeval &)
RealTime operator-(const RealTime &r) const
RealTime(const RealTime &r)
static RealTime frame2RealTime(long frame, unsigned int sampleRate)
Convert a sample frame at the given sample rate into a RealTime.
RealTime operator+(const RealTime &r) const
RealTime operator/(int d) const
static const RealTime zeroTime
static long realTime2Frame(const RealTime &r, unsigned int sampleRate)
Convert a RealTime into a sample frame at the given sample rate.
bool operator==(const RealTime &r) const
RealTime operator-() const
static RealTime fromSeconds(double sec)
bool operator>=(const RealTime &r) const