Changeset 4627 for trunk


Ignore:
Timestamp:
08/16/04 14:24:47 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4624 r4627  
    2626     - change to support also 'No calibration of data'
    2727     - removed obsolete dependancie on *'FromData' containers
     28
     29   * mbase/MTime.[h,cc]:
     30     - added new member function SetStringFmt
    2831
    2932
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r4563 r4627  
    333333
    334334    return kTRUE;
    335 
    336335}
    337336
     
    481480// --------------------------------------------------------------------------
    482481//
     482// Set the time according to the format fmt.
     483// Default is "%A %e.%B %Y %H:%M:%S"
     484//
     485// For more information see GetStringFmt
     486//
     487Bool_t MTime::SetStringFmt(const char *time, const char *fmt)
     488{
     489    if (!fmt)
     490        fmt = "%A %e.%B %Y %H:%M:%S";
     491
     492    struct tm t;
     493    memset(&t, 0, sizeof(struct tm));
     494    strptime(time, fmt, &t);
     495
     496    return Set(t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
     497}
     498
     499// --------------------------------------------------------------------------
     500//
    483501// Return contents as a TString of the form:
    484502//   "yyyy-mm-dd hh:mm:ss"
  • trunk/MagicSoft/Mars/mbase/MTime.h

    r4563 r4627  
    8181    Bool_t   SetSqlTimeStamp(const char *str);
    8282    void     SetCT1Time(UInt_t mjd, UInt_t t1, UInt_t t0);
     83    Bool_t   SetStringFmt(const char *time, const char *fmt);
    8384    Bool_t   UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UInt_t ns);
    8485    Bool_t   SetMjd(UInt_t mjd, ULong_t ms, UInt_t ns=0);
Note: See TracChangeset for help on using the changeset viewer.