Project

General

Profile

Actions

Support #907

closed

Why does CLOCKS_PER_SEC equal 128 in CrystaX (mangled-time.h)?

Added by Violet G. over 9 years ago. Updated over 9 years ago.

Status:
Completed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
03/19/2015
Due date:
% Done:

100%

Estimated time:
CPU Architecture:
arm
Host OS:
Windows
Toolchain:
gcc-4.9
Android version:
4.2 (android-17)
CrystaX NDK Version:

Description

CLOCKS_PER_SEC usually equals 1000 on Windows, and 1000000 on Unix systems (Linux / Mac OS X / Android). While I realize it can be an arbitrary value, I've never worked on a non-Windows system where it doesn't equal 1000000. Why is it 128 in CrystaX? That creates bugs like division by zero:

time_t start = clock();
Logger() << "Loaded in " << int(clock() - start) / (CLOCKS_PER_SEC / 1000) << " msec";

Here, integer division of CLOCKS_PER_SEC by 1000 results in 0 - completely unexpectedly.

P. S. Sorry for abusing the bug tracker - there don't seem to be any kind of a forum, and this is the only way I've found to ask a question.

Actions

Also available in: Atom PDF