patch 9.0.1567: profiler calculation may be wrong on 32 bit builds
Problem: Profiler calculation may be wrong on 32 bit builds.
Solution: Use 64 bit variable if possible. (Isao Sato, closes #12412)
diff --git a/src/profiler.c b/src/profiler.c
index 3d37a64..e101067 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -123,10 +123,11 @@
QueryPerformanceFrequency(&fr);
tm->QuadPart += (LONGLONG)((double)msec / 1000.0 * (double)fr.QuadPart);
# else
- long fsec;
+ varnumber_T fsec; // this should be 64 bit if possible
PROF_GET_TIME(tm);
- fsec = (long)tm->tv_fsec + (long)msec * (TV_FSEC_SEC / 1000);
+ fsec = (varnumber_T)tm->tv_fsec
+ + (varnumber_T)msec * (varnumber_T)(TV_FSEC_SEC / 1000);
tm->tv_fsec = fsec % (long)TV_FSEC_SEC;
tm->tv_sec += fsec / (long)TV_FSEC_SEC;
# endif