mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Document clock(3) as obsolete.
This commit is contained in:
parent
c8487ff12b
commit
bc1344dacf
1 changed files with 14 additions and 0 deletions
|
@ -53,6 +53,20 @@ similarly poorly named flag O_CREAT that does what you need.
|
||||||
|
|
||||||
Sortix currently implement this function for compatibility reasons.
|
Sortix currently implement this function for compatibility reasons.
|
||||||
|
|
||||||
|
clock
|
||||||
|
-----
|
||||||
|
|
||||||
|
The clock() function suffers from overflow issues where it wraps around and the
|
||||||
|
caller has to handle that, meaning it's not suitable for measuring long
|
||||||
|
intervals. Converting a clock interval to seconds it also bothersome and
|
||||||
|
requires division by CLOCKS_PER_SEC.
|
||||||
|
|
||||||
|
You should use clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) instead as it has no
|
||||||
|
overflow issues, provides nanosecond precision if available, and can be combined
|
||||||
|
with APIs such as Sortix's <timespec.h> for convenient computing.
|
||||||
|
|
||||||
|
Sortix currently implements this function for compatibility reasons.
|
||||||
|
|
||||||
ctime, ctime_r
|
ctime, ctime_r
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue