That didn't help compiling net.cpp and rpcnet.cpp, but now it does..
diff --git a/src/net.cpp b/src/net.cpp
index 4179b42..f7b28ec 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2157,13 +2157,13 @@ void CNode::RecordBytesSent(uint64 bytes)
nTotalBytesSent += bytes;
}
-uint64 CNode::GetTotalBytesRecv()
+uint64_t CNode::GetTotalBytesRecv()
{
LOCK(cs_totalBytesRecv);
return nTotalBytesRecv;
}
-uint64 CNode::GetTotalBytesSent()
+uint64_t CNode::GetTotalBytesSent()
{
LOCK(cs_totalBytesSent);
return nTotalBytesSent;
diff --git a/src/net.h b/src/net.h
index f2770eb..06e395f 100644
--- a/src/net.h
+++ b/src/net.h
@@ -764,8 +764,8 @@ public:
static void RecordBytesRecv(uint64 bytes);
static void RecordBytesSent(uint64 bytes);
- static uint64 GetTotalBytesRecv();
- static uint64 GetTotalBytesSent();
+ static uint64_t GetTotalBytesRecv();
+ static uint64_t GetTotalBytesSent();
};
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 14ec275..448e247 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -312,6 +312,6 @@ Value getnettotals(CWallet *pWallet, const Array& params, bool fHelp)
Object obj;
obj.push_back(Pair("totalbytesrecv", CNode::GetTotalBytesRecv()));
obj.push_back(Pair("totalbytessent", CNode::GetTotalBytesSent()));
- obj.push_back(Pair("timemillis", GetTimeMillis()));
+ obj.push_back(Pair("timemillis", static_cast(GetTimeMillis())));
return obj;
}
Also, what's the obsession in using boost in GetTimeMillis+GetTimeMicros?
Here's what it does:
21:15:29.740407 brk(0) = 0x1cb6000 <0.000010>
21:15:29.740447 brk(0x1cd7000) = 0x1cd7000 <0.000011>
21:15:29.740487 brk(0) = 0x1cd7000 <0.000010>
21:15:29.740535 open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3 <0.000016>
21:15:29.740589 fstat(3, {st_dev=makedev(252, 0), st_ino=12885149141, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=1883, st_atime=2014/03/21-01:01:58, st_mtime=2013/03/13-17:52:21, st_ctime=2014/03/20-18:11:40}) = 0 <0.000010>
21:15:29.740670 fstat(3, {st_dev=makedev(252, 0), st_ino=12885149141, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=1883, st_atime=2014/03/21-01:01:58, st_mtime=2013/03/13-17:52:21, st_ctime=2014/03/20-18:11:40}) = 0 <0.000010>
21:15:29.740747 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd16fbe1000 <0.000012>
21:15:29.740792 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 1883 <0.000016>
21:15:29.740847 lseek(3, -1201, SEEK_CUR) = 682 <0.000011>
21:15:29.740887 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\6\0\0\0\0"..., 4096) = 1201 <0.000011>
21:15:29.740936 close(3) = 0 <0.000013>
21:15:29.740979 munmap(0x7fd16fbe1000, 4096) = 0 <0.000022>
whereas gettimeofday does not even show up in strace
diff --git a/src/util.h b/src/util.h
index 98f9c7a..4c30446 100644
--- a/src/util.h
+++ b/src/util.h
@@ -353,14 +353,16 @@ inline int64 GetPerformanceCounter()
inline int64 GetTimeMillis()
{
- return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
- boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_milliseconds();
+ timeval t;
+ gettimeofday(&t, NULL);
+ return ((int64) t.tv_sec * 1000) + (t.tv_usec / 1000);
}
inline int64 GetTimeMicros()
{
- return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
- boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_microseconds();
+ timeval t;
+ gettimeofday(&t, NULL);
+ return ((int64) t.tv_sec * 1000000) + t.tv_usec;
}
inline std::string DateTimeStrFormat(const char* pszFormat, int64 nTime)