Work with TTimeStamp in Get/SetTimestamp functions of TSQLStatement

I’m using the last ROOT version to work with my experiment database.
But I’m not sure why GetTimestamp and TTimestamp functions of the TSQLStatement class have not normal support the TTimeStamp class and instead use TDatime class without fraction of seconds.
My PostgreSQL database stores timestamp objects with milliseconds but
TDatime TSQLStatement::GetTimestamp(Int_t npar) - returns TDatime (without ms)
Bool_t SetTimestamp (Int_t, const TDatime &) - gets TDatime instead of TTimeStamp.
So, despite the fact that they should work with fractions of seconds, these functions are the same as Get/SetDatime without frac.

Of course, there are functions with separate parts of the date/time - year, month,…,fraction of second but it is not so comfortable to use.
If there are no reasons why it has not been implemented, I can develop and add (via merge request) the following simple functions to ROOT:
TTimeStamp TSQLStatement::GetTimestamp(Int_t npar)
Bool_t SetTimestamp (Int_t, const TTimeStamp &).
Or can somebody do it?

With respect, Konstantin

I see author of this class is @linev. May be he has some ideas about your problem.

1 Like

Hi Konstantin,

I do not remember exactly why TTimeStamp was not provided.
But yes - you can submit PR.
Just be careful and do not change existing methods.
While you cannot have same method name/args list, you need to have another name - like GetTTimeStamp(int) / SetTTimeStamp


Thank you for quick response. So, i will prepare the PR.
I won’t change the existing functions, i will just add 2 new functions for TTimeStamp, which will be the similar as ones with TDatime with a small modification concerned the fraction part.
Yes, of course, you are right, i can’t use the same name GetTimeStamp because it returns TDatime, i will take it into account.
Thank you.

With respect, Konstantin.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.