diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -500,9 +500,15 @@ return self.sha256 def __repr__(self): + # time.ctime suffers from the 2038 Problem on some modern OSs, so limit + # what timestamps are pretty-printed until this is fixed. + displayTime = self.nTime + if abs(displayTime) <= pow(2, 31): + displayTime = time.ctime(displayTime) + return "CBlockHeader(nVersion={} hashPrevBlock={:064x} hashMerkleRoot={:064x} nTime={} nBits={:08x} nNonce={:08x})".format( self.nVersion, self.hashPrevBlock, self.hashMerkleRoot, - time.ctime(self.nTime), self.nBits, self.nNonce) + displayTime, self.nBits, self.nNonce) class CBlock(CBlockHeader): @@ -559,9 +565,15 @@ self.rehash() def __repr__(self): + # time.ctime suffers from the 2038 Problem on some modern OSs, so limit + # what timestamps are pretty-printed until this is fixed. + displayTime = self.nTime + if abs(displayTime) <= pow(2, 31): + displayTime = time.ctime(displayTime) + return "CBlock(nVersion={} hashPrevBlock={:064x} hashMerkleRoot={:064x} nTime={} nBits={:08x} nNonce={:08x} vtx={})".format( self.nVersion, self.hashPrevBlock, self.hashMerkleRoot, - time.ctime(self.nTime), self.nBits, self.nNonce, repr(self.vtx)) + displayTime, self.nBits, self.nNonce, repr(self.vtx)) class PrefilledTransaction: @@ -969,8 +981,14 @@ return r def __repr__(self): + # time.ctime suffers from the 2038 Problem on some modern OSs, so limit + # what timestamps are pretty-printed until this is fixed. + displayTime = self.nTime + if abs(displayTime) <= pow(2, 31): + displayTime = time.ctime(displayTime) + return 'msg_version(nVersion={} nServices={} nTime={} addrTo={} addrFrom={} nNonce=0x{:016X} strSubVer={} nStartingHeight={} nRelay={})'.format( - self.nVersion, self.nServices, time.ctime(self.nTime), + self.nVersion, self.nServices, displayTime, repr(self.addrTo), repr(self.addrFrom), self.nNonce, self.strSubVer, self.nStartingHeight, self.nRelay)