Hi,
I garnished the TTimeStamp class to be TimeStamp class.( pls see codes below). The problem is if I do
TimeStamp x;
TimeStamp y(x);
x.Print()
y.Print()
I got very different results and I expect them the same. My codes looks fine to me. Thank for your helps.
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
#ifndef ROOT_TTIMESTAMP
#include "TTimeStamp.h"
#endif
class TimeStamp: public TTimeStamp{
private:
public:
TimeStamp();
TimeStamp(const timespec_t& ts);
TimeStamp(const TimeStamp&);
TimeStamp(time_t t, Int_t nsec);
TimeStamp(UInt_t tloc, Bool_t isUTC = kTRUE, Int_t secOffset = 0, Bool_t dosDate = kFALSE);
TimeStamp(UInt_t date, UInt_t time, UInt_t nsec, Bool_t isUTC = kTRUE, Int_t secOffset = 0);
TimeStamp(UInt_t year, UInt_t month, UInt_t day, UInt_t hour, UInt_t min, UInt_t sec, UInt_t nsec = 0, Bool_t isUTC = kTRUE, Int_t secOffset = 0);
~TimeStamp();
Bool_t operator ==(const TimeStamp& b);
Bool_t operator <(const TimeStamp& b);
ClassDef(TimeStamp,1);
};
#endif
#include "TimeStamp.h"
#if !defined(__CINT__)
ClassImp(TimeStamp);
#endif
TimeStamp::TimeStamp():TTimeStamp(){};
TimeStamp::TimeStamp(const timespec_t& ts):TTimeStamp(ts){};
TimeStamp::TimeStamp(const TimeStamp& rhs):TTimeStamp(rhs){};
TimeStamp::TimeStamp(time_t t, Int_t nsec):TTimeStamp(t,nsec){};
TimeStamp::TimeStamp(UInt_t tloc, Bool_t isUTC, Int_t secOffset, Bool_t dosDate):TTimeStamp(tloc,isUTC,secOffset,dosDate){};
TimeStamp::TimeStamp(UInt_t date, UInt_t time, UInt_t nsec, Bool_t isUTC , Int_t secOffset ):
TTimeStamp(date,time,nsec,isUTC,secOffset){};
TimeStamp::TimeStamp(UInt_t year, UInt_t month, UInt_t day, UInt_t hour, UInt_t min, UInt_t sec, UInt_t nsec, Bool_t isUTC, Int_t secOffset ):
TTimeStamp(year,month,day,hour,min,sec,nsec,isUTC,secOffset){};
TimeStamp::~TimeStamp(){};
Bool_t TimeStamp::operator ==(const TimeStamp& b) {
return this->GetDate()==b.GetDate() && this->GetTime()== b.GetTime() && this->GetNanoSec()== b.GetNanoSec();
};
Bool_t TimeStamp::operator <(const TimeStamp& b) {
return this->GetDate()<b.GetDate() || this->GetTime()< b.GetTime() || this->GetNanoSec()< b.GetNanoSec();
};
cheers,
gma