Time Offset Example

From: OKUMURA, Akira <oxon_at_icrr.u-tokyo.ac.jp>
Date: Thu, 3 May 2007 23:28:49 -1000


Hello ROOTers,

I tried an example which was written in the page 122 of ROOT manual v. 5.14.

But I could not get an expected result. My result of "ht3" had time origin of "23-06h" on its x axis. I think the expected result does not depend on my time zone setting. The attached GIF is the result.

ROOT ver 5.15.02, OS X 10.4.9 (PPC) with gcc 4.0.1

I tried older ROOT version 4.04.02 and two time zone. The results were different each other.

version	TZ		origin
5.15.02	HST	=>	23-06h
5.15.02	JST	=>	24-01h
4.04.02	HST	=>	23-17.5h
4.04.02	JST	=>	23-15h (correct)

HST and JST means Hawaii Standard Time (-10 from GMT) and Japan Standard Time (+9 from GMT).

Sincerely,

OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan Phone/Fax : +81 4-7136-3153
Skype : okumura.akira

{

    gStyle->SetTitleH(0.08);
    TDatime da(2003,02,28,12,00,00);
    gStyle->SetTimeOffset(da.Convert());     ct = new TCanvas("ct","Time on axis",0,0,600,600);     ct->Divide(1,3);

    ht1 = new TH1F("ht1","ht1",30000,0.,200000.);
    ht2 = new TH1F("ht2","ht2",30000,0.,200000.);
    ht3 = new TH1F("ht3","ht3",30000,0.,200000.);
    for (Int_t i=1;i<30000;i++) {
       Float_t noise = gRandom->Gaus(0,120);
       ht1->SetBinContent(i,noise);
       ht2->SetBinContent(i,noise*noise);
       ht3->SetBinContent(i,noise*noise*noise);
    }
    ct->cd(1);
    ht1->GetXaxis()->SetLabelSize(0.06);
    ht1->GetXaxis()->SetTimeDisplay(1);
    ht1->GetXaxis()->SetTimeFormat("%d\/%m\/%y%F2000-02-2813:00:01");
    ht1->Draw();

    ct->cd(2);
    ht2->GetXaxis()->SetLabelSize(0.06);
    ht2->GetXaxis()->SetTimeDisplay(1);
    ht2->GetXaxis()->SetTimeFormat("%d\/%m\/%y");
    ht2->Draw();

    ct->cd(3);
    ht3->GetXaxis()->SetLabelSize(0.06);     TDatime dh(2001,09,23,15,00,00);
    ht3->GetXaxis()->SetTimeDisplay(1);
    ht3->GetXaxis() ht3->Draw();
ct.gif
Received on Fri May 04 2007 - 11:30:01 CEST

This archive was generated by hypermail 2.2.0 : Fri May 04 2007 - 17:50:02 CEST