From fcada6849bca81d29cdad126918fa15b5cc58e8b Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 13 Apr 2016 07:37:29 +0800 Subject: [PATCH] default timezone changed --- main.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/main.cpp b/main.cpp index 0546462..2431a40 100644 --- a/main.cpp +++ b/main.cpp @@ -23,6 +23,22 @@ int main() { path blockchain_path {"/home/mwo/.bitmonero/lmdb"}; + + // change timezone to Universtal time zone + char old_tz[128]; + const char *tz_org = getenv("TZ"); + + if (tz_org) + { + strcpy(old_tz, tz_org); + } + + // set new timezone + std::string tz = "TZ=Coordinated Universal Time"; + putenv(const_cast(tz.c_str())); + tzset(); // Initialize timezone data + + // enable basic monero log output xmreg::enable_monero_log(); @@ -61,5 +77,12 @@ int main() { app.port(8080).multithreaded().run(); + // set timezone to orginal value + if (tz_org != 0) + { + setenv("TZ", old_tz, 1); + tzset(); + } + return 0; } \ No newline at end of file