Browse Source

Remove unused utiltime.cpp

master
cronicc 6 years ago
parent
commit
ab26290332
No known key found for this signature in database GPG Key ID: FB7053CE4991B669
  1. 13
      binding.gyp
  2. 1
      util.cpp
  3. 57
      utiltime.cpp
  4. 20
      utiltime.h

13
binding.gyp

@ -6,14 +6,13 @@
],
"sources": [
"support/cleanse.cpp",
"uint256.cpp",
"support/cleanse.cpp",
"uint256.cpp",
"arith_uint256.cpp",
"random.cpp",
"util.cpp",
"utiltime.cpp",
"utilstrencodings.cpp",
"crypto/equihash.cpp",
"random.cpp",
"util.cpp",
"utilstrencodings.cpp",
"crypto/equihash.cpp",
"crypto/hmac_sha256.cpp",
"crypto/hmac_sha512.cpp",
"crypto/ripemd160.cpp",

1
util.cpp

@ -11,7 +11,6 @@
#include "random.h"
#include "serialize.h"
#include "utilstrencodings.h"
#include "utiltime.h"
#include <stdarg.h>

57
utiltime.cpp

@ -1,57 +0,0 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#endif
#include "utiltime.h"
#include <chrono>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
using namespace std;
static int64_t nMockTime = 0; //! For unit testing
int64_t GetTime()
{
if (nMockTime) return nMockTime;
return time(NULL);
}
void SetMockTime(int64_t nMockTimeIn)
{
nMockTime = nMockTimeIn;
}
int64_t GetTimeMillis()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch()).count();
}
int64_t GetTimeMicros()
{
return std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::system_clock::now().time_since_epoch()).count();
}
void MilliSleep(int64_t n)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(n));
}
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
{
// std::locale takes ownership of the pointer
std::locale loc(std::locale::classic(), new boost::posix_time::time_facet(pszFormat));
std::stringstream ss;
ss.imbue(loc);
ss << boost::posix_time::from_time_t(nTime);
return ss.str();
}

20
utiltime.h

@ -1,20 +0,0 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UTILTIME_H
#define BITCOIN_UTILTIME_H
#include <stdint.h>
#include <string>
int64_t GetTime();
int64_t GetTimeMillis();
int64_t GetTimeMicros();
void SetMockTime(int64_t nMockTimeIn);
void MilliSleep(int64_t n);
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);
#endif // BITCOIN_UTILTIME_H
Loading…
Cancel
Save