Fix bug in m_sleep()
diff --git a/ChangeLog b/ChangeLog
index 5d48ef8..f2c42ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@
Alex Wilson.)
* Fixed bug in ssl_cache: when max_entries = 0 and TIMING_C is enabled,
entries would still be created.
+ * Fixed bug in m_sleep: whould sleep twice too long on most Unix platforms.
= PolarSSL 1.3.4 released on 2014-01-27
Features
diff --git a/library/timing.c b/library/timing.c
index c70b78c..f1d8a1f 100644
--- a/library/timing.c
+++ b/library/timing.c
@@ -302,7 +302,7 @@
struct timeval tv;
tv.tv_sec = milliseconds / 1000;
- tv.tv_usec = milliseconds * 1000;
+ tv.tv_usec = ( milliseconds % 1000 ) * 1000;
select( 0, NULL, NULL, NULL, &tv );
}