diff options
| author | Gregory Maxwell <[email protected]> | 2012-03-10 16:05:28 -0500 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2012-03-10 17:38:37 -0500 |
| commit | 82a10c81707dcff5ee24dec7ef7ebf8eccfded03 (patch) | |
| tree | 7629dc24efea6c45289478741b4b01b60128c7d6 /src/util.h | |
| parent | Merge pull request #918 from nomnombtc/patch-1 (diff) | |
| download | discoin-82a10c81707dcff5ee24dec7ef7ebf8eccfded03.tar.xz discoin-82a10c81707dcff5ee24dec7ef7ebf8eccfded03.zip | |
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.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util.h b/src/util.h index 31d327529..d5e8a71cd 100644 --- a/src/util.h +++ b/src/util.h @@ -88,7 +88,9 @@ T* alignup(T* p) #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 |