Still have a little bit of a problem with VisualizationData . . .
[aesalon.git] / gui / src / storage / Timestamp.cpp
blob4a969ae8d42f27be2ddcf893707a2da3e52aebe0
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;
40 void Timestamp::add_ms(qint64 ms) {
41 internal_time = internal_time.addMSecs(ms);