You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.7 KiB
66 lines
1.7 KiB
#include <log4cplus/helpers/timehelper.h>
|
|
#include <log4cplus/streams.h>
|
|
#include <iostream>
|
|
|
|
using namespace log4cplus;
|
|
using namespace log4cplus::helpers;
|
|
|
|
|
|
log4cplus::tchar const fmtstr[] =
|
|
LOG4CPLUS_TEXT("%s, %Q%%q%q %%Q %%q=%%%q%%;%%q, %%Q=%Q");
|
|
|
|
|
|
int
|
|
main()
|
|
{
|
|
std::cout << "Entering main()..." << std::endl;
|
|
log4cplus::initialize ();
|
|
try
|
|
{
|
|
Time time;
|
|
log4cplus::tstring str;
|
|
|
|
time = Time::gettimeofday ();
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << LOG4CPLUS_TEXT ("now: ") << str << std::endl;
|
|
|
|
time = Time (0, 7);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
|
|
time = Time (0, 17);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
|
|
time = Time (0, 123);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
|
|
time = Time (0, 1234);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
|
|
time = Time (0, 12345);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
|
|
time = Time (0, 123456);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
|
|
time = Time (0, 0);
|
|
str = time.getFormattedTime (fmtstr);
|
|
log4cplus::tcout << str << std::endl;
|
|
}
|
|
catch(std::exception const & e)
|
|
{
|
|
std::cout << "Exception: " << e.what () << std::endl;
|
|
}
|
|
catch(...)
|
|
{
|
|
std::cout << "Exception..." << std::endl;
|
|
}
|
|
|
|
std::cout << "Exiting main()..." << std::endl;
|
|
return 0;
|
|
}
|