QTime.hh

Go to the documentation of this file.
00001 
00007 #ifndef _QTIME_HH_
00008 #define _QTIME_HH_
00009 
00010 #include "QObject.hh"
00011 #include <ctime>
00012 #include <iostream>
00013 #include <string>
00014 
00015 Q_BEGIN_NAMESPACE 
00016 
00017 class QTime : public QObject {
00018   
00019 public:
00021   QTime();
00023   QTime(time_t time):QObject(QObject::Time){fStartRunUnix=time; fFromStartRunNs=0ULL;}
00024 
00026   virtual ~QTime();
00027 
00029   void SetFromStartRunNs(unsigned long long time) {fFromStartRunNs = time;}
00030 
00032   void SetStartRunUnix(unsigned int time) {fStartRunUnix = time;}
00033 
00035   void SetStartRunUnix(int year, int month, int day, int hour, int min, int sec);
00036 
00038   unsigned long long GetFromStartRunNs() const {return fFromStartRunNs;}
00039 
00041   time_t GetStartRunUnix() const {return fStartRunUnix;}
00042 
00044   time_t GetTimeSec()const {return fStartRunUnix+int(fFromStartRunNs/1e9);}
00045 
00047   unsigned int GetTimeNSec()const {return fFromStartRunNs%1000000000;}
00048 
00050   std::string GetTimeAsString() const {time_t tmp= GetTimeSec(); return ctime(&tmp);}
00051 
00053   bool operator==(const QTime& other) const;
00054 
00056   bool operator<(const QTime& other) const;
00057 
00059   void Clear();
00060 
00061 private:
00062 
00063   unsigned long long fFromStartRunNs;
00064   unsigned int fStartRunUnix;
00065 
00066 };
00067 
00068 /* @brief formatted printout */
00069 std::ostream& operator<<(std::ostream&s,const QTime&t);
00070 
00071 Q_END_NAMESPACE
00072 
00073 #endif

Generated on Tue Nov 16 10:49:56 2010 for CUORE Software by  doxygen 1.5.6