Well, that would be why the ActiveBlocks data isn't correct . . .
[aesalon.git] / gui / src / storage / Timestamp.cpp
blobeca6741344344f6c426774e121df2eeb24ac8e7c
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 bool Timestamp::operator>=(const Timestamp &other) const {
16 return internal_time >= other.internal_time;
19 bool Timestamp::operator==(const Timestamp &other) const {
20 return internal_time == other.internal_time;
23 Timestamp &Timestamp::operator=(const Timestamp &other) {
24 internal_time = other.internal_time;
25 return *this;
28 qint64 Timestamp::seconds_until(const Timestamp& other) const {
29 return internal_time.secsTo(other.internal_time);
32 qint64 Timestamp::ms_until(const Timestamp& other) const {
33 /*qint64 seconds = seconds_until(other);*/
34 QTime this_time = internal_time.time();
35 QTime other_time = other.internal_time.time();
37 if(*this < other) {
38 if(this_time <= other_time) return this_time.msecsTo(other_time);
39 else qCritical("NOTE: comparision between different-day QTimes NYI! (1)");
41 else if(*this >= other) {
42 if(this_time >= other_time) return -other_time.msecsTo(this_time);
43 else qCritical("NOTE: comparision between different-day QTimes NYI! (2)");
45 return -1;
48 void Timestamp::add_ms(qint64 ms) {
49 internal_time = internal_time.addMSecs(ms);
52 QString Timestamp::to_string() const {
53 return internal_time.toString();