2
Is it possible to calculate the difference between two time records separated by less than one second using the computer clock? For example, between 12h00m00s000ms and 12h00m00s050ms.
2
Is it possible to calculate the difference between two time records separated by less than one second using the computer clock? For example, between 12h00m00s000ms and 12h00m00s050ms.
1
Take a look at this: clock_getres, clock_gettime, clock_settime And here: http://man7.org/linux/man-pages/man2/clock_gettime.2.html
int clock_getres(clockid_t clk_id, struct timespec *res);
The function
clock_getres()
finds the resolution (accuracy) of the watchclk_id
specified, and, ifres
is notNULL
, stores the result in the structtimespec
pointed byres
. The resolution of clocks depends on implementation and cannot be configured by a particular process. If the time value pointed by the argumenttp
ofclock_settime()
is not a multiple ofres
, then it is truncated to a multiple ofres
.int clock_gettime(clockid_t clk_id, struct timespec *tp); int clock_settime(clockid_t clk_id, const struct timespec *tp);
The functions
clock_gettime()
andclock_settime()
recover and assign the time of the clockclk_id
specified.
The idea of rejecting answers only with a link is not only a question of the link "disappear" or not: it is important for the community to have content here, and in Portuguese. If you don’t want to translate the documentation, you are in your right (by the way, I’ll give you a little help on this... ;) ) but could at least put an example of usage, an informal explanation of what the methods do, or something like that.
P.S. I’m sorry if you think it wasn’t right for me to edit your answer without your consent. Anything, just revert to original review.
The problem is that you translated a "piece" of documentation. I am Frances and we have in many cases the same problem with documentation mainly in English. It is possible to translate, right. But in this case, I think that Francis should not only keep the translation but that he should read the full doc. Good luck to him! And thank you so much for Grandpa!
Of course, a link accompanying the answer is always welcome, even if in another language. The problem is when the whole or almost the whole of the answer consists of the link.
Browser other questions tagged c linux
You are not signed in. Login or sign up in order to post.
See if you can get help http://stackoverflow.com/a/16276032/221800
– Maniero