Re-implemented TimeSlider.
[aesalon.git] / gui / src / storage / Timestamp.cpp
blobc1f642c8c350ffa063f2eb497df2eb9be8408481
1 #include "Timestamp.h"
3 bool Timestamp::operator<(const Timestamp &other) const {
4 return internal_time < other.internal_time;
7 bool Timestamp::operator>(const Timestamp &other) const {
8 return internal_time > other.internal_time;
11 bool Timestamp::operator==(const Timestamp &other) const {
12 return internal_time == other.internal_time;
15 Timestamp &Timestamp::operator=(const Timestamp &other) {
16 internal_time = other.internal_time;
17 return *this;
20 qint64 Timestamp::seconds_until(const Timestamp& other) const {
21 return internal_time.secsTo(other.internal_time);
24 qint64 Timestamp::ms_until(const Timestamp& other) const {
25 qint64 seconds = seconds_until(other);
26 QTime t = internal_time.time();
27 QTime t2 = other.internal_time.time();
29 if(*this < other) {
30 if(t < t2) return t.msecsTo(t2);
31 else qCritical("NOTE: comparision between different-day QTimes NYI!");
33 else {
34 if(t > t2) return t.msecsTo(t2);
35 else qCritical("NOTE: comparision between different-day QTimes NYI!");
37 return -1;