43 #define PRINTVALUE( V ) \ 44 cout << #V << ":\n " << string(V) << endl; 52 X Instance(Initializer);
53 std::cout << Instance.timestring()
54 <<
" initialized from string \"" 55 << Initializer <<
"\"" << endl;
59 const long int &month,
const long int &day,
60 const long int &hour=0,
const long int &minute=0,
61 const long int &second=0,
const long int &milsec=0,
62 const long int &micsec=0)
65 second,milsec,micsec);
67 <<
" initialized from values: " 68 << year <<
" " << month <<
" " << day <<
" " 69 << hour <<
" " << minute <<
" " << second <<
" " 70 << milsec <<
" " << micsec << endl;
74 const long int &hour=0,
const long int &minute=0,
75 const long int &second=0,
const long int &milsec=0,
76 const long int &micsec=0)
79 second,milsec,micsec);
81 <<
" initialized from values: " 83 << hour <<
" " << minute <<
" " << second <<
" " 84 << milsec <<
" " << micsec << endl;
91 <<
" initialized from " 103 std::cout <<
"Hello world!\n";
105 std::cout <<
"\nTesting constructors" 106 <<
"\n====================" << endl;
108 std::cout <<
"\nTesting TAbsoluteTime" 109 <<
"\n---------------------" << endl;
110 init_from_string<libtime::TAbsoluteTime>(
"0/1/1");
111 init_from_string<libtime::TAbsoluteTime>(
"70/1/1");
112 init_from_string<libtime::TAbsoluteTime>(
"60/1/1");
113 init_from_string<libtime::TAbsoluteTime>(
"160/1/1");
114 init_from_string<libtime::TAbsoluteTime>(
"1978/1/1");
115 init_from_string<libtime::TAbsoluteTime>(
"1978/13/1");
116 init_from_string<libtime::TAbsoluteTime>(
"1978/1/2/3/4/5/6/7/8/9");
123 std::cout <<
"\nTesting TRelativeTime" 124 <<
"\n---------------------" << endl;
125 init_from_string<libtime::TRelativeTime>(
"0");
126 init_from_string<libtime::TRelativeTime>(
"8");
127 init_from_string<libtime::TRelativeTime>(
"123.23.34.45.56789");
128 init_from_string<libtime::TRelativeTime>(
"123.2345.34567.45678.56789");
149 cout << string(Q) << endl;
150 cout << string(OneSecond) << endl;
151 cout << string(Q%OneSecond) << endl;
152 long int numbo=Q/OneSecond;
153 cout << Q/OneSecond << endl;
154 cout << string(OneSecond*numbo) << endl;
155 numbo=(Now-Then)/OneSecond;
156 cout << numbo <<
" seconds from " 157 << string(Now) << endl <<
" to " << string(Then) << endl;
159 cout <<
"these are " << string(Q) << endl <<
" and lead to " 160 << string(Now+Q) << endl <<
" from " << string(Now) << endl;
166 std::cout <<
"hierarchical strings:" << std::endl;
175 std::cout <<
"\nSystematically test derived units" 176 <<
"\n---------------------------------" << endl;
void init_from_string(const std::string &Initializer)
double time2double(const TRelativeTime &rtime)
convert relative time to seconds
provide a convenient way to specify time intervals in the order of one hour
provide a convenient way to specify time intervals in the order of one microsecond ...
TRelativeTime double2time(const double &seconds)
convert seconds to relative time
TAbsoluteTime utc()
return system time in UTC
provide a convenient way to specify time intervals in the order of one day
void Ainit_from_value(const long int &year, const long int &month, const long int &day, const long int &hour=0, const long int &minute=0, const long int &second=0, const long int &milsec=0, const long int &micsec=0)
class to contain relative times
std::string timestring() const
provide a convenient way to specify time intervals in the order of one minute
std::string hierarchicalstring() const
std::string timestring(const std::string &format) const
return string representation of time.
provide a convenient way to specify time intervals in the order of one millisecond ...
void Rinit_from_value(const long int &days, const long int &hour=0, const long int &minute=0, const long int &second=0, const long int &milsec=0, const long int &micsec=0)
TAbsoluteTime now()
return system time
provide a convenient way to specify time intervals in the order of one second
class to contain absolute times
void init_from_seconds(const double &seconds)
std::string hierarchicalstring() const