diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2012-09-19 17:39:17 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2012-09-19 17:40:46 +0100 |
commit | 3b9aea04d23bb9e7d058953e075c38525e9baa11 (patch) | |
tree | 6e5568eac494476b8b8bb563245df183950e9706 /win32 | |
parent | 3cd504478422d444c3a75de45b4fe50f5bab7843 (diff) | |
download | perl-3b9aea04d23bb9e7d058953e075c38525e9baa11.tar.gz |
Add new warning about sleep's limitation on Windows
This also came up recently in [perl #33096]. On Windows, sleep's unsigned
int argument range is effectively reduced by a factor of 1000 because the
emulation uses milliseconds rather than seconds.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index a16410fad4..8bb13694c3 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2426,7 +2426,11 @@ win32_sleep(unsigned int t) { dTHX; /* Win32 times are in ms so *1000 in and /1000 out */ - return win32_msgwait(aTHX_ 0, NULL, t*1000, NULL)/1000; + if (t > UINT_MAX / 1000) { + Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), + "sleep(%lu) too large", t); + } + return win32_msgwait(aTHX_ 0, NULL, t * 1000, NULL) / 1000; } DllExport unsigned int |