Fix division by zero warning on FreeBSD libc. Closes
@@ -180,7 +180,12 @@ m3ApiRawFunction(m3_libc_clock_ms)
{
m3ApiReturnType (uint32_t)
#ifdef CLOCKS_PER_SEC
- m3ApiReturn(clock() / (CLOCKS_PER_SEC/1000));
+ uint32_t clock_divider = CLOCKS_PER_SEC/1000;
+ if (clock_divider != 0) {
+ m3ApiReturn(clock() / clock_divider);
+ } else {
+ m3ApiReturn(clock());
+ }
#else
m3ApiReturn(clock());
#endif
