From d96dbe936539d2b2105c97796acbd4b7727a5b13 Mon Sep 17 00:00:00 2001 From: r4sas Date: Mon, 6 Feb 2017 16:18:23 +0300 Subject: [PATCH] use _USE_32BIT_TIME_T in win32 build Add i2pd.exe in .gitignore --- .gitignore | 1 + Timestamp.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 73297488..961b53b5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ netDb /i2pd /libi2pd.a /libi2pdclient.a +i2pd.exe # Autotools diff --git a/Timestamp.cpp b/Timestamp.cpp index 6079c881..3131fb6a 100644 --- a/Timestamp.cpp +++ b/Timestamp.cpp @@ -5,6 +5,12 @@ #include "I2PEndian.h" #include "Timestamp.h" +#ifdef WIN32 + #ifndef _WIN64 + #define _USE_32BIT_TIME_T + #endif +#endif + namespace i2p { namespace util @@ -33,17 +39,17 @@ namespace util socket.send_to (boost::asio::buffer (buf, 48), ep); int i = 0; while (!socket.available() && i < 10) // 10 seconds max - { + { std::this_thread::sleep_for (std::chrono::seconds(1)); i++; - } + } if (socket.available ()) len = socket.receive_from (boost::asio::buffer (buf, 48), ep); } catch (std::exception& e) { LogPrint (eLogError, "NTP error: ", e.what ()); - } + } if (len >= 8) { auto ourTs = GetSecondsSinceEpoch (); @@ -51,10 +57,10 @@ namespace util if (ts > 2208988800U) ts -= 2208988800U; // 1/1/1970 from 1/1/1900 g_TimeOffset = ts - ourTs; LogPrint (eLogInfo, address, " time offset from system time is ", g_TimeOffset, " seconds"); - } + } } } - } + } } }