Files
Sourcetrail/src/lib/utility/TimePoint.h
T
Eberhard Graether 706119ebcc data: indexer processes
* TaskBuildIndex starts seperate indexer processes and communicates via shared memory
* indexer processes get restarted if they fail
* indexer processes are killed when the app closes or crashes
* added utility class SharedMemory to allocate and access shared memory, providing basic data structures
* added SharedMemoryGarbageCollector for keeping track of running instances and cleaning up shared memory in case of a crash
* show errors for source files that crashed during indexing
* added basic exception handling to task scheduling
* added option to turn off processes and use threads in preferences, but still use shared memory

fortune cookie message = Good news from someone dear is coming soon.
2017-05-04 15:50:59 +02:00

41 lines
1.3 KiB
C++

#ifndef TIME_POINT_H
#define TIME_POINT_H
#include "boost/date_time/posix_time/posix_time.hpp"
class TimePoint // that name sounds pretty silly, was time stamp not ok?
{
public:
static TimePoint now();
TimePoint();
TimePoint(boost::posix_time::ptime t);
//TimePoint(time_t t);
TimePoint(std::string s);
bool isValid() const;
std::string toString() const;
std::string getDDMMYYYYString() const;
inline bool operator==(const TimePoint& rhs){ return m_time == rhs.m_time; }
inline bool operator!=(const TimePoint& rhs){ return m_time != rhs.m_time; }
inline bool operator<(const TimePoint& rhs){ return m_time < rhs.m_time; }
inline bool operator>(const TimePoint& rhs){ return m_time > rhs.m_time; }
inline bool operator<=(const TimePoint& rhs){ return m_time <= rhs.m_time; }
inline bool operator>=(const TimePoint& rhs){ return m_time >= rhs.m_time; }
inline float operator-(const TimePoint& rhs){ return deltaMS(rhs) / 1000.0f; }
size_t deltaMS(const TimePoint& other) const;
size_t deltaS(const TimePoint& other) const;
bool isSameDay(const TimePoint& other) const;
size_t deltaDays(const TimePoint& other) const; // days are counted beginning at 00:00, so a tp of 1.1.2017 23:59 is 1 day ago if it's the 2.1.2017 00:01
private:
boost::posix_time::ptime m_time;
};
#endif // TIME_POINT_H