Skip to content

Commit

Permalink
Update util.h
Browse files Browse the repository at this point in the history
  • Loading branch information
cqtenq committed Sep 24, 2014
1 parent c86c181 commit da79a74
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/util.h
Expand Up @@ -44,18 +44,6 @@ static const int64_t CENT = 1000000;
#define UEND(a) ((unsigned char*)&((&(a))[1]))
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))

/* Format characters for (s)size_t, ptrdiff_t.
*
* Define these as empty as the tinyformat-based formatting system is
* type-safe, no special format characters are needed to specify sizes.
*/
#define PRIszx "x"
#define PRIszu "u"
#define PRIszd "d"
#define PRIpdx "x"
#define PRIpdu "u"
#define PRIpdd "d"

// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
#define PAIRTYPE(t1, t2) std::pair<t1, t2>

Expand Down Expand Up @@ -118,6 +106,7 @@ extern volatile bool fReopenDebugLog;

void RandAddSeed();
void RandAddSeedPerfmon();
void SetupEnvironment();

/* Return true if log accepts specified category */
bool LogAcceptCategory(const char* category);
Expand Down Expand Up @@ -165,7 +154,6 @@ static inline bool error(const char* format)

void LogException(std::exception* pex, const char* pszThread);
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
void ParseString(const std::string& str, char c, std::vector<std::string>& v);
std::string FormatMoney(int64_t n, bool fPlus=false);
bool ParseMoney(const std::string& str, int64_t& nRet);
bool ParseMoney(const char* pszIn, int64_t& nRet);
Expand Down Expand Up @@ -332,14 +320,7 @@ inline int64_t GetTimeMicros()
boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_microseconds();
}

inline std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
{
time_t n = nTime;
struct tm* ptmTime = gmtime(&n);
char pszTime[200];
strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
return pszTime;
}
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);

template<typename T>
void skipspaces(T& it)
Expand Down Expand Up @@ -540,7 +521,7 @@ inline uint32_t ByteReverse(uint32_t value)
// threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds));
template <typename Callable> void LoopForever(const char* name, Callable func, int64_t msecs)
{
std::string s = strprintf("bitcoin-%s", name);
std::string s = strprintf("feathercoin-%s", name);
RenameThread(s.c_str());
LogPrintf("%s thread start\n", name);
try
Expand Down Expand Up @@ -568,7 +549,7 @@ template <typename Callable> void LoopForever(const char* name, Callable func,
// .. and a wrapper that just calls func once
template <typename Callable> void TraceThread(const char* name, Callable func)
{
std::string s = strprintf("bitcoin-%s", name);
std::string s = strprintf("feathercoin-%s", name);
RenameThread(s.c_str());
try
{
Expand Down

0 comments on commit da79a74

Please sign in to comment.