Changeset 10253


Ignore:
Timestamp:
03/23/11 10:48:45 (14 years ago)
Author:
tbretz
Message:
Added exaple for SetFrom Str and GetAsStr, remove fractional seconds from example where is was not working.
File:
1 edited

Legend:

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

    r10251 r10253  
    5454
    5555    // Stream the time in its sql representation into the stringstream
    56     str << Time::sql << bd;
     56    str << Time::ssql << bd;
    5757
    5858    // Stream a time from the stringstream considering an sql representation
    5959    // into a Time object
    6060    Time tm;
    61     str >> Time::sql >> tm;
     61    str >> Time::ssql >> tm;
    6262
    6363    // Output stream and interpreted time
    6464    cout << "Stream: " << str.str() << endl;
    65     cout << "Time:   " << Time::sql << tm << endl;
     65    cout << "Time:   " << Time::ssql << tm << endl;
    6666    cout << endl;
    6767
     
    7373    cout << endl;
    7474
     75    // Set and get a Time from a string
     76    const string s = "2042-12-24 12:42:42";
     77
     78    Time tstr;
     79    tstr.SetFromStr(s);
     80    cout << "String:      " << s << endl;
     81    cout << "TimeFromStr: " << tstr.GetAsStr() << endl;
     82    cout << endl;
     83
     84    // Calculate with times
    7585    const Time t0;
    7686    Time t1 = t0;
Note: See TracChangeset for help on using the changeset viewer.