Changeset 15006


Ignore:
Timestamp:
03/10/13 11:13:26 (12 years ago)
Author:
tbretz
Message:
Added initializer from an ISO string, fixed the wrong ISO format description in Time::iso.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Time.cc

    r13954 r15006  
    4040const _time_format Time::sql    = "%Y-%m-%d %H:%M:%S.%f";
    4141const _time_format Time::ssql   = "%Y-%m-%d %H:%M:%S";
    42 const _time_format Time::iso    = "%Y%m%dT%H%M%S%F%q";
     42const _time_format Time::iso    = "%Y-%m-%dT%H:%M:%S%F%q";
    4343const _time_format Time::magic  = "%Y %m %d %H %M %S %f";
    4444const _time_format Time::smagic = "%Y %m %d %H %M %S";
     
    243243{
    244244    stringstream out;
    245     out << Time::fmt("%Y-%m-%dT%H:%M:%S%F") << *this;
     245    out << Time::iso << *this;
    246246    return out.str();
    247247}
  • trunk/FACT++/src/Time.h

    r14542 r15006  
    2525    /// initialize ptr with what should be passed to the iostreams
    2626    _time_format(const char *txt) : ptr(txt) { }
     27    std::string str() const { return ptr; }
    2728};
    2829
     
    5354    };
    5455
    55 private:
     56public:
    5657    /// Points to the famous 1/1/1970, the standard offset for unix times
    5758    const static boost::gregorian::date fUnixOffset;
     
    6768         unsigned int us=0);
    6869    Time(double mjd) { Mjd(mjd); }
     70    Time(const std::string &str)
     71    {
     72        std::stringstream stream;
     73        stream << str;
     74        stream >> Time::iso >> *this;
     75    }
    6976
    7077    // Convesion from and to a string
Note: See TracChangeset for help on using the changeset viewer.