std::ostream& operator«(std::ostream& s, TimeStamp& t) throw (TimeStampException); |
#include <ctime>
std::ostream& operator«(std::ostream& s, TimeStamp& t)
throw (TimeStampException) {
using namespace std;
time_t theTime = (time_t) t.get();
char* buffer;
try {
buffer = ctime(&theTime);
} catch (...) {
cerr « "TimeStamp::updateTimeStamp(): "
"couldn't print system time" « endl;
throw TimeStampException();
}
buffer[strlen(buffer) - 1] = '
0';
s « buffer;
return s;
}