Loading include/log/log_read.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -100,6 +100,12 @@ public: log_time local(*this); log_time local(*this); return local -= T; return local -= T; } } log_time operator+= (const timespec &T); log_time operator+ (const timespec &T) const { log_time local(*this); return local += T; } // log_time // log_time bool operator== (const log_time &T) const bool operator== (const log_time &T) const Loading Loading @@ -134,6 +140,12 @@ public: log_time local(*this); log_time local(*this); return local -= T; return local -= T; } } log_time operator+= (const log_time &T); log_time operator+ (const log_time &T) const { log_time local(*this); return local += T; } uint64_t nsec() const uint64_t nsec() const { { Loading liblog/log_time.cpp +22 −0 Original line number Original line Diff line number Diff line Loading @@ -150,6 +150,17 @@ log_time log_time::operator-= (const timespec &T) { return *this; return *this; } } log_time log_time::operator+= (const timespec &T) { this->tv_nsec += (unsigned long int)T.tv_nsec; if (this->tv_nsec >= NS_PER_SEC) { this->tv_nsec -= NS_PER_SEC; ++this->tv_sec; } this->tv_sec += T.tv_sec; return *this; } log_time log_time::operator-= (const log_time &T) { log_time log_time::operator-= (const log_time &T) { // No concept of negative time, clamp to EPOCH // No concept of negative time, clamp to EPOCH if (*this <= T) { if (*this <= T) { Loading @@ -166,3 +177,14 @@ log_time log_time::operator-= (const log_time &T) { return *this; return *this; } } log_time log_time::operator+= (const log_time &T) { this->tv_nsec += T.tv_nsec; if (this->tv_nsec >= NS_PER_SEC) { this->tv_nsec -= NS_PER_SEC; ++this->tv_sec; } this->tv_sec += T.tv_sec; return *this; } Loading
include/log/log_read.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -100,6 +100,12 @@ public: log_time local(*this); log_time local(*this); return local -= T; return local -= T; } } log_time operator+= (const timespec &T); log_time operator+ (const timespec &T) const { log_time local(*this); return local += T; } // log_time // log_time bool operator== (const log_time &T) const bool operator== (const log_time &T) const Loading Loading @@ -134,6 +140,12 @@ public: log_time local(*this); log_time local(*this); return local -= T; return local -= T; } } log_time operator+= (const log_time &T); log_time operator+ (const log_time &T) const { log_time local(*this); return local += T; } uint64_t nsec() const uint64_t nsec() const { { Loading
liblog/log_time.cpp +22 −0 Original line number Original line Diff line number Diff line Loading @@ -150,6 +150,17 @@ log_time log_time::operator-= (const timespec &T) { return *this; return *this; } } log_time log_time::operator+= (const timespec &T) { this->tv_nsec += (unsigned long int)T.tv_nsec; if (this->tv_nsec >= NS_PER_SEC) { this->tv_nsec -= NS_PER_SEC; ++this->tv_sec; } this->tv_sec += T.tv_sec; return *this; } log_time log_time::operator-= (const log_time &T) { log_time log_time::operator-= (const log_time &T) { // No concept of negative time, clamp to EPOCH // No concept of negative time, clamp to EPOCH if (*this <= T) { if (*this <= T) { Loading @@ -166,3 +177,14 @@ log_time log_time::operator-= (const log_time &T) { return *this; return *this; } } log_time log_time::operator+= (const log_time &T) { this->tv_nsec += T.tv_nsec; if (this->tv_nsec >= NS_PER_SEC) { this->tv_nsec -= NS_PER_SEC; ++this->tv_sec; } this->tv_sec += T.tv_sec; return *this; }