Changeset 9208


Ignore:
Timestamp:
01/05/09 17:52:49 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9207 r9208  
    3232   * star.cc:
    3333     - removed obsolete -ff option from output
     34
     35   * mbase/MTime.[h,cc]:
     36     - added GetBinary
     37     - added WriteBinary
     38
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r9156 r9208  
    886886}
    887887
     888// --------------------------------------------------------------------------
     889//
     890// Calls Set(t[0], t[1], t[2], t[3], t[4], t[5], 0)
     891//
    888892Bool_t MTime::SetBinary(const UInt_t t[6])
    889893{
     
    891895}
    892896
     897// --------------------------------------------------------------------------
     898//
     899// Assign:
     900//    t[0] = year;
     901//    t[1] = month;
     902//    t[2] = day;
     903//    t[3] = hour;
     904//    t[4] = minute;
     905//    t[5] = second;
     906//
     907void MTime::GetBinary(UInt_t t[6]) const
     908{
     909    UShort_t yea, ms;
     910    Byte_t mon, day, h, m, s;
     911
     912    GetDate(yea, mon, day);
     913    GetTime(h, m, s, ms);
     914
     915    t[0] = yea;
     916    t[1] = mon;
     917    t[2] = day;
     918    t[3] = h;
     919    t[4] = m;
     920    t[5] = s;
     921}
     922
     923// --------------------------------------------------------------------------
     924//
     925// Read seven bytes representing y, m, d, h, m, s
     926//
    893927istream &MTime::ReadBinary(istream &fin)
    894928{
     
    908942}
    909943
     944// --------------------------------------------------------------------------
     945//
     946// Write seven bytes representing y, m, d, h, m, s
     947//
     948ostream &MTime::WriteBinary(ostream &out) const
     949{
     950    UShort_t y, ms;
     951    Byte_t mon, d, h, m, s;
     952
     953    GetDate(y, mon, d);
     954    GetTime(h, m, s, ms);
     955
     956    out.read((char*)&y,   2);
     957    out.read((char*)&mon, 1);
     958    out.read((char*)&d,   1);
     959    out.read((char*)&h,   1);
     960    out.read((char*)&m,   1);
     961    out.read((char*)&s,   1); // Total=7
     962}
     963
    910964void MTime::AddMilliSeconds(UInt_t ms)
    911965{
  • trunk/MagicSoft/Mars/mbase/MTime.h

    r9156 r9208  
    118118    TString  GetSqlTimeStamp() const;
    119119    TString  GetFileName() const;
     120    void     GetBinary(UInt_t t[6]) const;
    120121    void     GetDate(UShort_t &y, Byte_t &m, Byte_t &d) const;
    121122    MTime    GetDateOfSunrise() const;
     
    154155    // I/O functions
    155156    istream &ReadBinary(istream &fin);
     157    ostream &WriteBinary(ostream &out) const;
    156158
    157159    void AsciiRead(istream &fin);
Note: See TracChangeset for help on using the changeset viewer.