dear rooters,
I am trying to read timestamp as a class from a root file.
Instead of getting the time saved in the file I am getting the time
automatically set from my system ( the day of today).
Thanks for the suggestion.
I still end up reading the time from my system instead of the rootfile.
Here is the code. #include <TROOT.h> #include <TChain.h> #include <TFile.h> #include <TTimeStamp.h> #include <TObject.h>
void test(){
TFile *file = new TFile(“FILENAME.root”);
TTree tree = (TTree) file->Get(“TREENAME”);
TTimeStamp *timstmp = 0;
tree->SetMakeClass(1);
//reading time branch from rootfile
tree->SetBranchAddress(“timestamp”, &timstmp);
//reading time leaf from rootfile
Int_t fSec;
TBranch *b_timestamp_fSec; //!
tree->SetBranchAddress(“fSec”, &fSec, &b_timestamp_fSec);
for(int i=0;i<10;i++){
tree->GetEntry(i);
cout <<fSec << " " << timstmp->AsString(“C”)<< endl;
//Print Should match but timstmp grabs the time of system.
}
file->Close();