From 176b70a0d47119d14a81bf0d633aaa77b248dca9 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 13 Jan 2017 22:12:27 +0000 Subject: [PATCH] account: fix build error involving std::max and different types --- src/cryptonote_core/account.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cryptonote_core/account.cpp b/src/cryptonote_core/account.cpp index 60256148..bd703eee 100644 --- a/src/cryptonote_core/account.cpp +++ b/src/cryptonote_core/account.cpp @@ -82,7 +82,9 @@ DISABLE_VS_WARNINGS(4244 4345) if (recover) { - m_creation_timestamp = std::max(mktime(×tamp), (long)0); + m_creation_timestamp = mktime(×tamp); + if (m_creation_timestamp == (uint64_t)-1) // failure + m_creation_timestamp = 0; // lowest value } else { @@ -105,7 +107,9 @@ DISABLE_VS_WARNINGS(4244 4345) timestamp.tm_min = 0; timestamp.tm_sec = 0; - m_creation_timestamp = std::max(mktime(×tamp), (long)0); + m_creation_timestamp = mktime(×tamp); + if (m_creation_timestamp == (uint64_t)-1) // failure + m_creation_timestamp = 0; // lowest value } //----------------------------------------------------------------- void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)