Re: [ROOT] TAxis::SetTimeFormat question

From: Christian Vogel (vogel@skunk.physik.uni-erlangen.de)
Date: Wed Aug 04 2004 - 17:16:22 MEST


Hi,

On Tue, Aug 03, 2004 at 12:31:49PM +0200, Thomas Bretz wrote:
> how do I get rid of the summer-/winter-time treatment in 
> TAxis::SetTimeFormat. I want that a histogram (showing UTC!) always 
> shows the same time independant of the season.

you can set the environment-variable TZ to UTC before starting root,
under Unix in a bourne-like shell like this:

	--- root session ---
	chris@pi2105:~$ date
	Wed Aug  4 17:12:43 CEST 2004
	chris@pi2105:~$ TZ=UTC date
	Wed Aug  4 15:12:45 UTC 2004

	# ^- this just shows how the TZ variable affects the date command
	# v- root also uses strftime(), like date

	chris@pi2105:~$ TZ=UTC root -l
	root [0] .x utc_time.C
	<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
	root [1] 

	--- utc.time.C ---
	{
		Double_t a = time(NULL);
		Double_t x[]={a,a+60,a+120,a+180,a+240};
		Double_t y[]={1,2,3,4,5};
		TGraph g(5,x,y);
		g.GetXaxis()->SetTimeDisplay(1);
		g.GetXaxis()->SetTimeFormat("%H:%M:%S");
		g.Draw("A*");
	}


.... shows a X-Axis labeled 15:13:00 .. 15:17:00 (UTC)

Also there is some interesting stuff on http://root.cern.ch/root/HowtoTimeAxis.html
which I just now found...

	Chris

-- 
"Anybody who has ever seen a photograph showing the kind of damage that
a trout traveling that fast can inflict on the human skull knows that
such photographs are very valuable. I paid $20 for mine." - Dave Barry



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET