1 | #include <iostream> |
---|---|
2 | #include <common/DateLUT.h> |
3 | #include <Poco/Exception.h> |
4 | |
5 | int main(int argc, char ** argv) |
6 | { |
7 | try |
8 | { |
9 | const auto & date_lut = DateLUT::instance(); |
10 | std::cout << "Detected default timezone: `"<< date_lut.getTimeZone() << "'"<< std::endl; |
11 | time_t now = time(NULL); |
12 | std::cout << "Current time: "<< date_lut.timeToString(now) |
13 | << ", UTC: "<< DateLUT::instance( "UTC").timeToString(now) << std::endl; |
14 | } |
15 | catch (const Poco::Exception & e) |
16 | { |
17 | std::cerr << e.displayText() << std::endl; |
18 | return 1; |
19 | } |
20 | catch (std::exception & e) |
21 | { |
22 | std::cerr << "std::exception: "<< e.what() << std::endl; |
23 | return 2; |
24 | } |
25 | catch (...) |
26 | { |
27 | std::cerr << "Some exception"<< std::endl; |
28 | return 3; |
29 | } |
30 | return 0; |
31 | } |
32 |