RE: TDatime::Set() SQL DateTime Format

From: Lee, Kerry T. (JSC-SF)[LMIT] <kerry.t.lee_at_nasa.gov>
Date: Thu, 3 May 2007 07:57:59 -0500


Rene,

Thanks for the quick implementation!

Kerry

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch on behalf of Rene Brun Sent: Thu 5/3/2007 4:20 AM
To: Lee, Kerry T. (JSC-SF)[LMIT]
Cc: roottalk_at_pcroot.cern.ch
Subject: Re: [ROOT] TDatime::Set() SQL DateTime Format  

Hi Kerry,

Thanks for this suggestion and the code ::) Now implemented in CVS head.

Rene Brun

Lee, Kerry T. (JSC-SF)[LMIT] wrote:
>
> 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();
> }
> }
>
Received on Thu May 03 2007 - 14:58:59 CEST

This archive was generated by hypermail 2.2.0 : Thu May 03 2007 - 23:50:01 CEST