2017-03-23 14:41:04 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <common/DateLUT.h>
|
|
|
|
#include <Poco/Exception.h>
|
|
|
|
|
2020-03-18 03:27:32 +00:00
|
|
|
int main(int, char **)
|
2017-03-23 14:41:04 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
const auto & date_lut = DateLUT::instance();
|
|
|
|
std::cout << "Detected default timezone: `" << date_lut.getTimeZone() << "'" << std::endl;
|
2020-03-09 01:50:33 +00:00
|
|
|
time_t now = time(nullptr);
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cout << "Current time: " << date_lut.timeToString(now)
|
|
|
|
<< ", UTC: " << DateLUT::instance("UTC").timeToString(now) << std::endl;
|
|
|
|
}
|
|
|
|
catch (const Poco::Exception & e)
|
|
|
|
{
|
|
|
|
std::cerr << e.displayText() << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
catch (std::exception & e)
|
|
|
|
{
|
|
|
|
std::cerr << "std::exception: " << e.what() << std::endl;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
std::cerr << "Some exception" << std::endl;
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
return 0;
|
2017-03-23 14:41:04 +00:00
|
|
|
}
|