diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c
index 9630ed3b6659959207d8f0efda8050b73d267f49..9ef247d302fc90db24f712b7c2d50a6e7b455aea 100644
--- a/src/xpdev/genwrap.c
+++ b/src/xpdev/genwrap.c
@@ -695,14 +695,9 @@ char* os_cmdshell(void)
 /********************************************************/
 clock_t msclock(void)
 {
-        long double t = roundl(xp_timer() * 1000);
+	uint64_t = (uint64_t)(xp_timer() * 1000);
 
-        if (sizeof(clock_t) < 8) {
-                while (t > INT32_MAX)
-                        t -= UINT32_MAX;
-        }
-
-	return (clock_t)t;
+	return (clock_t)(t&0xffffffff);
 }
 
 /****************************************************************************/