Mercurial > hg > svcore
comparison base/RealTime.h @ 1429:48e9f538e6e9
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | c811991a5efa |
children | 71207822a7e0 |
comparison
equal
deleted
inserted
replaced
1428:87ae75da6527 | 1429:48e9f538e6e9 |
---|---|
49 | 49 |
50 RealTime(): sec(0), nsec(0) {} | 50 RealTime(): sec(0), nsec(0) {} |
51 RealTime(int s, int n); | 51 RealTime(int s, int n); |
52 | 52 |
53 RealTime(const RealTime &r) : | 53 RealTime(const RealTime &r) : |
54 sec(r.sec), nsec(r.nsec) { } | 54 sec(r.sec), nsec(r.nsec) { } |
55 | 55 |
56 RealTime(const Vamp::RealTime &r) : | 56 RealTime(const Vamp::RealTime &r) : |
57 sec(r.sec), nsec(r.nsec) { } | 57 sec(r.sec), nsec(r.nsec) { } |
58 | 58 |
59 static RealTime fromSeconds(double sec); | 59 static RealTime fromSeconds(double sec); |
60 static RealTime fromMilliseconds(int msec); | 60 static RealTime fromMilliseconds(int msec); |
61 static RealTime fromTimeval(const struct timeval &); | 61 static RealTime fromTimeval(const struct timeval &); |
62 static RealTime fromXsdDuration(std::string xsdd); | 62 static RealTime fromXsdDuration(std::string xsdd); |
63 | 63 |
64 double toDouble() const; | 64 double toDouble() const; |
65 Vamp::RealTime toVampRealTime() const { return Vamp::RealTime(sec, nsec); } | 65 Vamp::RealTime toVampRealTime() const { return Vamp::RealTime(sec, nsec); } |
66 | 66 |
67 RealTime &operator=(const RealTime &r) { | 67 RealTime &operator=(const RealTime &r) { |
68 sec = r.sec; nsec = r.nsec; return *this; | 68 sec = r.sec; nsec = r.nsec; return *this; |
69 } | 69 } |
70 | 70 |
71 RealTime operator+(const RealTime &r) const { | 71 RealTime operator+(const RealTime &r) const { |
72 return RealTime(sec + r.sec, nsec + r.nsec); | 72 return RealTime(sec + r.sec, nsec + r.nsec); |
73 } | 73 } |
74 RealTime operator-(const RealTime &r) const { | 74 RealTime operator-(const RealTime &r) const { |
75 return RealTime(sec - r.sec, nsec - r.nsec); | 75 return RealTime(sec - r.sec, nsec - r.nsec); |
76 } | 76 } |
77 RealTime operator-() const { | 77 RealTime operator-() const { |
78 return RealTime(-sec, -nsec); | 78 return RealTime(-sec, -nsec); |
79 } | 79 } |
80 | 80 |
81 bool operator <(const RealTime &r) const { | 81 bool operator <(const RealTime &r) const { |
82 if (sec == r.sec) return nsec < r.nsec; | 82 if (sec == r.sec) return nsec < r.nsec; |
83 else return sec < r.sec; | 83 else return sec < r.sec; |
84 } | 84 } |
85 | 85 |
86 bool operator >(const RealTime &r) const { | 86 bool operator >(const RealTime &r) const { |
87 if (sec == r.sec) return nsec > r.nsec; | 87 if (sec == r.sec) return nsec > r.nsec; |
88 else return sec > r.sec; | 88 else return sec > r.sec; |
89 } | 89 } |
90 | 90 |
91 bool operator==(const RealTime &r) const { | 91 bool operator==(const RealTime &r) const { |
92 return (sec == r.sec && nsec == r.nsec); | 92 return (sec == r.sec && nsec == r.nsec); |
93 } | 93 } |