On Mon Aug 1 08:19:23 EDT 2011, [email protected] wrote:
> I am setting up some timing tests and am currently dumping the
> timestamps using nsec(). When I post-process the data I find that the
> it is wrapping around, but I have not found anything that clearly states
> when it does that. From the code I am guessing that is on the second
> boundary. Is that correct?
if nsec(2) is wrapping around then time(2) will also wrap around.
i have not seen nsec do anything like that. it sounds to me like
you may be having integer truncation problems. are you using a
(u)vlong variable to store the results of nsec?
- erik
---
; cat > nsec.c
#include <u.h>
#include <libc.h>
void
main(void)
{
print("%llud\n", nsec());
sleep(10000);
print("%llud\n", nsec());
}
<eot>; tmk nsec.c
8c -FVTw nsec.c
8l -o 8.nsec nsec.8
; 8.nsec
1312201920700241540
1312201930703219588
; hoc
(1312201930703219588 - 1312201920700241540)/1e9
10.002978048