Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=bf507c62735601267fbefaf27140c784b396c6bb
commit bf507c62735601267fbefaf27140c784b396c6bb Author: Michel Hermier <[email protected]> Date: Fri Aug 1 13:20:39 2014 +0200 libpacman: Fix bug in Timestamp::operator -, and add toEpoch converter. diff --git a/lib/libpacman/timestamp.h b/lib/libpacman/timestamp.h index c4b246a..0a5c6e1 100644 --- a/lib/libpacman/timestamp.h +++ b/lib/libpacman/timestamp.h @@ -35,14 +35,14 @@ struct Timestamp : m_value(epoch) { } - double operator - (const libpacman::Timestamp &other) const + bool operator == (const time_t &epoch) const { - return difftime(m_value, &other.m_value); + return m_value == epoch; } - bool operator == (const time_t &epoch) const + double operator - (const libpacman::Timestamp &other) const { - return m_value == epoch; + return difftime(m_value, other.m_value); } bool isValid() const @@ -50,6 +50,11 @@ struct Timestamp return m_value != PM_TIME_INVALID; } + time_t toEpoch() const + { + return m_value; + } + time_t m_value; }; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
