Skip to content

Commit

Permalink
PPCoin: Change date display format and clean up a merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyking committed Jul 25, 2012
1 parent 44f6017 commit 5856141
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,7 @@ Value getcheckpoint(const Array& params, bool fHelp)
result.push_back(Pair("synccheckpoint", Checkpoints::hashSyncCheckpoint.ToString().c_str()));
pindexCheckpoint = mapBlockIndex[Checkpoints::hashSyncCheckpoint];
result.push_back(Pair("height", pindexCheckpoint->nHeight));
result.push_back(Pair("timestamp", DateTimeStrFormat("%x %H:%M:%S", pindexCheckpoint->GetBlockTime()).c_str()));
result.push_back(Pair("timestamp", DateTimeStrFormat(pindexCheckpoint->GetBlockTime()).c_str()));

return result;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ map<uint256, map<uint256, CDataStream*> > mapOrphanTransactionsByPrev;
// Constant stuff for coinbase transactions we create:
CScript COINBASE_FLAGS;

const string strMessageMagic = "Bitcoin Signed Message:\n";
const string strMessageMagic = "PPCoin Signed Message:\n";

double dHashesPerSec;
int64 nHPSTimerStart;
Expand Down Expand Up @@ -2163,7 +2163,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
string strMessage = _("Warning: Disk space is low");
strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
ThreadSafeMessageBox(strMessage, "Bitcoin", wxOK | wxICON_EXCLAMATION | wxMODAL);
ThreadSafeMessageBox(strMessage, "PPCoin", wxOK | wxICON_EXCLAMATION | wxMODAL);
StartShutdown();
return false;
}
Expand Down Expand Up @@ -2366,7 +2366,7 @@ void PrintBlockTree()
pindex->nBlockPos,
block.GetHash().ToString().substr(0,20).c_str(),
block.nBits,
DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
DateTimeStrFormat(block.GetBlockTime()).c_str(),
block.vtx.size());

PrintWallets(block);
Expand Down Expand Up @@ -2553,7 +2553,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
static map<CService, vector<unsigned char> > mapReuseKey;
RandAddSeedPerfmon();
if (fDebug) {
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
printf("%s ", DateTimeStrFormat(GetTime()).c_str());
printf("received: %s (%d bytes)\n", strCommand.c_str(), vRecv.size());
}
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
Expand Down Expand Up @@ -3826,7 +3826,7 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
printf("BitcoinMiner:\n");
printf("new block found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());
pblock->print();
printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
printf("%s ", DateTimeStrFormat(GetTime()).c_str());
printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str());

// Found a solution
Expand Down Expand Up @@ -3987,7 +3987,7 @@ void static BitcoinMiner(CWallet *pwallet)
if (GetTime() - nLogTime > 30 * 60)
{
nLogTime = GetTime();
printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
printf("%s ", DateTimeStrFormat(GetTime()).c_str());
printf("hashmeter %3d CPUs %6.0f khash/s\n", vnThreadsRunning[THREAD_MINER], dHashesPerSec/1000.0);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ void CNode::CloseSocketDisconnect()
if (hSocket != INVALID_SOCKET)
{
if (fDebug)
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
printf("%s ", DateTimeStrFormat(GetTime()).c_str());
printf("disconnecting node %s\n", addr.ToString().c_str());
closesocket(hSocket);
hSocket = INVALID_SOCKET;
Expand Down Expand Up @@ -888,7 +888,7 @@ void ThreadMapPort2(void* parg)
}
}

string strDesc = "Bitcoin " + FormatFullVersion();
string strDesc = "PPCoin " + FormatFullVersion();
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
Expand Down Expand Up @@ -1478,7 +1478,7 @@ bool BindListenPort(string& strError)
{
int nErr = WSAGetLastError();
if (nErr == WSAEADDRINUSE)
strError = strprintf(_("Unable to bind to port %d on this computer. Bitcoin is probably already running."), ntohs(sockaddr.sin_port));
strError = strprintf(_("Unable to bind to port %d on this computer. PPCoin is probably already running."), ntohs(sockaddr.sin_port));
else
strError = strprintf("Error: Unable to bind to port %d on this computer (bind returned error %d)", ntohs(sockaddr.sin_port), nErr);
printf("%s\n", strError.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class CNode
vSend << CMessageHeader(pszCommand, 0);
nMessageStart = vSend.size();
if (fDebug) {
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
printf("%s ", DateTimeStrFormat(GetTime()).c_str());
printf("sending: %s ", pszCommand);
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/rpcdump.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2009-2012 Bitcoin Developers
// Copyright (c) 2012 The PPCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -42,7 +43,7 @@ Value importprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"importprivkey <bitcoinprivkey> [label]\n"
"importprivkey <ppcoinprivkey> [label]\n"
"Adds a private key (as returned by dumpprivkey) to your wallet.");

string strSecret = params[0].get_str();
Expand Down Expand Up @@ -82,13 +83,13 @@ Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey <bitcoinaddress>\n"
"Reveals the private key corresponding to <bitcoinaddress>.");
"dumpprivkey <ppcoinaddress>\n"
"Reveals the private key corresponding to <ppcoinaddress>.");

string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(-5, "Invalid bitcoin address");
throw JSONRPCError(-5, "Invalid ppcoin address");
CSecret vchSecret;
bool fCompressed;
if (!pwalletMain->GetSecret(address, vchSecret, fCompressed))
Expand Down
17 changes: 8 additions & 9 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void RandAddSeedPerfmon()
{
RAND_add(pdata, nSize, nSize/100.0);
memset(pdata, 0, nSize);
printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat(GetTime()).c_str(), nSize);
}
#endif
}
Expand Down Expand Up @@ -224,7 +224,7 @@ inline int OutputDebugStringF(const char* pszFormat, ...)

// Debug print useful for profiling
if (fLogTimestamps && fStartedNewLine)
fprintf(fileout, "%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
fprintf(fileout, "%s ", DateTimeStrFormat(GetTime()).c_str());
if (pszFormat[strlen(pszFormat) - 1] == '\n')
fStartedNewLine = true;
else
Expand Down Expand Up @@ -777,7 +777,7 @@ void FormatException(char* pszMessage, std::exception* pex, const char* pszThrea
pszModule[0] = '\0';
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else
const char* pszModule = "bitcoin";
const char* pszModule = "ppcoin";
#endif
if (pex)
snprintf(pszMessage, 1000,
Expand Down Expand Up @@ -1071,10 +1071,10 @@ void AddTimeData(const CNetAddr& ip, int64 nTime)
if (!fMatch)
{
fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong PPCoin will not work properly.");
strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
ThreadSafeMessageBox(strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION);
ThreadSafeMessageBox(strMessage+" ", string("PPCoin"), wxOK | wxICON_EXCLAMATION);
}
}
}
Expand Down Expand Up @@ -1122,7 +1122,7 @@ std::string FormatSubVersion(const std::string& name, int nClientVersion, const
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) / "Bitcoin.lnk";
return MyGetSpecialFolderPath(CSIDL_STARTUP, true) / "PPCoin.lnk";
}

bool GetStartOnSystemStartup()
Expand Down Expand Up @@ -1203,7 +1203,7 @@ boost::filesystem::path static GetAutostartDir()

boost::filesystem::path static GetAutostartFilePath()
{
return GetAutostartDir() / "bitcoin.desktop";
return GetAutostartDir() / "ppcoin.desktop";
}

bool GetStartOnSystemStartup()
Expand All @@ -1219,7 +1219,6 @@ bool GetStartOnSystemStartup()
if (line.find("Hidden") != string::npos &&
line.find("true") != string::npos)
return false;
>>>>>>> bitcoin
}
optionFile.close();

Expand All @@ -1245,7 +1244,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
// Write a bitcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=Bitcoin\n";
optionFile << "Name=PPCoin\n";
optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";
Expand Down
6 changes: 6 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ inline std::string DateTimeStrFormat(const char* pszFormat, int64 nTime)
return pszTime;
}

static const std::string strTimestampFormat = "%F %H:%M:%S";
inline std::string DateTimeStrFormat(int64 nTime)
{
return DateTimeStrFormat(strTimestampFormat.c_str(), nTime);
}

template<typename T>
void skipspaces(T& it)
{
Expand Down
13 changes: 8 additions & 5 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,11 +1049,14 @@ bool CWallet::SelectCoinsMinConf(int64 nTargetValue, unsigned int nSpendTime, in
}

//// debug print
printf("SelectCoins() best subset: ");
for (unsigned int i = 0; i < vValue.size(); i++)
if (vfBest[i])
printf("%s ", FormatMoney(vValue[i].first).c_str());
printf("total %s\n", FormatMoney(nBest).c_str());
if (fDebug && GetBoolArg("-printselectcoin"))
{
printf("SelectCoins() best subset: ");
for (unsigned int i = 0; i < vValue.size(); i++)
if (vfBest[i])
printf("%s ", FormatMoney(vValue[i].first).c_str());
printf("total %s\n", FormatMoney(nBest).c_str());
}
}

return true;
Expand Down
5 changes: 3 additions & 2 deletions src/walletdb.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2012 The PPCoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

Expand Down Expand Up @@ -191,7 +192,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet)
//printf("LoadWallet %s\n", wtx.GetHash().ToString().c_str());
//printf(" %12"PRI64d" %s %s %s\n",
// wtx.vout[0].nValue,
// DateTimeStrFormat("%x %H:%M:%S", wtx.GetBlockTime()).c_str(),
// DateTimeStrFormat(wtx.GetBlockTime()).c_str(),
// wtx.hashBlock.ToString().substr(0,20).c_str(),
// wtx.mapValue["message"].c_str());
}
Expand Down Expand Up @@ -367,7 +368,7 @@ void ThreadFlushWalletDB(void* parg)
map<string, int>::iterator mi = mapFileUseCount.find(strFile);
if (mi != mapFileUseCount.end())
{
printf("%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
printf("%s ", DateTimeStrFormat(GetTime()).c_str());
printf("Flushing wallet.dat\n");
nLastFlushed = nWalletDBUpdated;
int64 nStart = GetTimeMillis();
Expand Down

0 comments on commit 5856141

Please sign in to comment.