Example for the usage of the class Time
#include <iostream>
{
cout << endl;
cout << "Universal CT: " << utc << endl;
cout <<
"User defined: " <<
Time::fmt(
"%Y=%m=%d %H=%M=%S.%f") << utc << endl;
cout <<
"SQL-format: " <<
Time::sql << utc << endl;
cout <<
"ISO-format: " <<
Time::iso << utc << endl;
cout << endl;
cout << str.str() << endl;
cout << endl;
const double mjd1 = utc.
Mjd();
cout <<
"Mjd: " <<
Time::sql << utc <<
" (" << mjd1 <<
")" << endl;
utc.Mjd(mjd1);
const double mjd2 = utc.Mjd();
cout <<
"Mjd: " <<
Time::sql << utc <<
" (" << mjd2 <<
")" << endl;
cout << "Diff: " << mjd1 - mjd2 << endl;
cout << endl;
const Time bd(1974, 9, 9, 21, 59, 42, 123456);
cout <<
"Loc default: " <<
Time::def << bd << endl;
cout <<
"Standard: " <<
Time::std << bd << endl;
cout << endl;
str.str("");
cout << "Stream: " << str.str() << endl;
cout << endl;
cout << "Elements: ";
cout << tm.Y() << " " << tm.M() << " " << tm.D() << " " ;
cout << tm.h() << " " << tm.m() << " " << tm.s() << " " ;
cout << tm.us() << endl;
cout << endl;
const string s = "2042-12-24 12:42:42";
cout << "String: " << s << endl;
cout <<
"TimeFromStr: " << tstr.
GetAsStr() << endl;
cout << endl;
cout << "T0 = " << t0 << endl;
cout << "T1 = " << t1 << endl;
t1 += hours(4242);
cout << "T1 += 4242h: " << t1 << endl;
t1 += minutes(42);
cout << "T1 += 42min: " << t1 << endl;
t1 += seconds(42);
cout << "T1 += 42sec: " << t1 << endl;
cout << endl;
cout << "T1 - T0 = " << t1-t0 << endl;
const time_duration diff = t1-t0;
cout << "T1 - T0 = " << diff.total_seconds() << "sec" << endl;
cout << endl;
return 0;
}