Dear ROOT team,
Could you include a Set function for the TDatime class that allows one to set an existing object using the SQL DateTime format? See modified code below.
Thanks
Kerry
//insert following Set method into TDatime.h
void Set(const char *sqlDateTime);
//replace current constructor in TDatime.cxx TDatime::TDatime(const char *sqlDateTime) {
// Expects as input a string in SQL date/time compatible format, like:
// yyyy-mm-dd hh:mm:ss.
Set(sqlDateTime);
}
//add implementation of new Set method in TDatime.cxx void TDatime::Set(const char* sqlDateTime) {
// Expects as input a string in SQL date/time compatible format, like:
// yyyy-mm-dd hh:mm:ss.
Int_t yy, mm, dd, hh, mi, ss;
if (sscanf(sqlDateTime, "%d-%d-%d %d:%d:%d", &yy, &mm, &dd, &hh, &mi, &ss) == 6)
Set(yy, mm, dd, hh, mi, ss);
else {
Error("TDatime(sqlDatTime)", "input string not in right format, set" " to current date/time"); Set();
This archive was generated by hypermail 2.2.0 : Thu May 03 2007 - 11:50:02 CEST