aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2012-03-10 16:05:28 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2012-03-11 21:53:47 -0400
commit11c34e0f6cf9cb2715c28b85a1ec8f47bf5ca8dd (patch)
tree6876e7b136728c857aeb3f64a676f49778713fab /src/util.h
parent88aa771536014919e955c4f7b2cada9a0dcf8561 (diff)
downloadbitcoin-11c34e0f6cf9cb2715c28b85a1ec8f47bf5ca8dd.tar.xz
Resolves issue #922 - "wallet passphrase timeout of several years doesn't work"
2^31 milliseconds is only about 25 days. Also clamps Sleep() to 10 years, because it currently sleeps for 0 seconds when the sleep time would cross 2^31 seconds since the epoch. Hopefully boost will be fixed by 2028.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util.h b/src/util.h
index c4ee19fe01..4e4cbb9f60 100644
--- a/src/util.h
+++ b/src/util.h
@@ -115,7 +115,9 @@ typedef u_int SOCKET;
#define Beep(n1,n2) (0)
inline void Sleep(int64 n)
{
- boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n));
+ /*Boost has a year 2038 problem— if the request sleep time is past epoch+2^31 seconds the sleep returns instantly.
+ So we clamp our sleeps here to 10 years and hope that boost is fixed by 2028.*/
+ boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n>315576000000LL?315576000000LL:n));
}
#endif