From e578b1c79a81bb3a25c1814c30776d76db711f65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg2@elzevir.fr>
Date: Tue, 18 Aug 2015 20:11:48 +0200
Subject: [PATCH] Relax timing_self_test for windows idiosyncrasies

---
 library/timing.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/library/timing.c b/library/timing.c
index aee9dd4e7..6c4d57622 100644
--- a/library/timing.c
+++ b/library/timing.c
@@ -414,7 +414,9 @@ int mbedtls_timing_self_test( int verbose )
 
         millisecs = mbedtls_timing_get_timer( &hires, 0 );
 
-        if( millisecs < 900 * secs || millisecs > 1100 * secs )
+        /* For some reason on Windows it looks like alarm has an extra delay
+         * (maybe related to creating a new thread). Allow some room here. */
+        if( millisecs < 800 * secs || millisecs > 1200 * secs + 300 )
         {
             if( verbose != 0 )
                 mbedtls_printf( "failed\n" );