- Better timer for Windows platforms
 - Made alarmed volatile for better Windows compatibility
diff --git a/include/polarssl/timing.h b/include/polarssl/timing.h
index 456508d..355c63c 100644
--- a/include/polarssl/timing.h
+++ b/include/polarssl/timing.h
@@ -39,7 +39,7 @@
 extern "C" {
 #endif
 
-extern int alarmed;
+extern volatile int alarmed;
 
 /**
  * \brief          Return the CPU cycle counter value
diff --git a/library/timing.c b/library/timing.c
index 109f70f..94c36d1 100644
--- a/library/timing.c
+++ b/library/timing.c
@@ -137,6 +137,18 @@
 }
 
 #else
+#if defined(_MSC_VER)
+
+unsigned long hardclock( void )
+{
+    LARGE_INTEGER offset;
+    
+	QueryPerformanceCounter( &offset );
+
+	return (unsigned long)( offset.QuadPart );
+}
+
+#else
 
 static int hardclock_init = 0;
 static struct timeval tv_init;
@@ -157,6 +169,7 @@
 }
 
 #endif /* generic */
+#endif /* WIN32   */
 #endif /* IA-64   */
 #endif /* Alpha   */
 #endif /* SPARC8  */
@@ -164,7 +177,7 @@
 #endif /* AMD64   */
 #endif /* i586+   */
 
-int alarmed = 0;
+volatile int alarmed = 0;
 
 #if defined(_WIN32)