In the resulting plot all dates are shifted by 25 years into the future. So I think the TAxis uses 1995-1-1 as the base for the timestamp. Is this behaviour intended and is there a way to bypass this problem?
BTW, I already found the documentation in your posted link when I searched for a solution all by myself. But from that I understood that the offset must be 01-01-1995 or greater. So maybe your hint to set the offset (without the conversion via TDatime as done in all of the examples) could be included somewhere in the documentation?
And I stay with my opinion that it is really confusing that TDatime only accepts dates after 01-01-1995 (why?) but returns seconds since 01-01-1970 which is not the default of TAxis.
But the last example has no explanations and I originally thought that it was there to illustrate the use of “gmt” and considered an offset of 0 merely as the default. Since the use of Unix time is common I would recommend a short paragraph about its use together with TAxis in the howto to help others struggling with the same issue.
Sorry to dig this old thread, but I believe the not so obvious has to be stated explicitely somewhere, so here it is : date in TDatime having to be younger than 1995, gStyle->SetTimeOffset(TDatime(“1970-01-01 0:00:00”).Convert()) won’t work. To set the offset as a date between 1970 and 1995, one has to compute the timestamp outside ROOT (or by whichever other method I’m not aware of), then feed it to gStyle->SetTimeOffset(). That is, gStyle->SetTimeOffset(0) will set the offset such that UNIX timestamps will be correctly displayed.
I think it could be useful. I believe the most frequent wanted behaviour is a compliance with the standard UNIX timestamp, so at least mentioning that this is obtained by setting the offset as 0 may be a good idea. But anyway, now it is mentioned here and I found the howto thanks to this topic, so do as you want.