Two quick Posix questions
1) Is there an equivalent Posix call for timeGetTime()? I want to be able to time a function to the millisecond level (at least). Is it clock_gettime(CLOCK_REALTIME, ×pec) and then look at timespec''s tv_nsec member?
2) Is there a set of Posix documentation available that is as good as MSDN or the Java API docs? What I''ve downloaded is IEEE Std 1003.1-2001, but is there something nicer? For instance, I don''t see where structures are listed all in a nice list (klike all the system interfaces are). I have to click on clock_gettime(), then click on time.h link and scroll to see the bit about the timespec structure.
Thanks,
Jeff
Another option I''ve seen is:
clock_t clock();
which returns the CPU time used since the process was invoked (I think). You need to divide the result by CLOCKS_PER_SEC to get the time in seconds, so I assume I''d go:
(clock()*1000)/CLOCK_PER_SEC
to get the value in milliseconds...
Anyone? Anyone?
Regards,
Jeff
clock_t clock();
which returns the CPU time used since the process was invoked (I think). You need to divide the result by CLOCKS_PER_SEC to get the time in seconds, so I assume I''d go:
(clock()*1000)/CLOCK_PER_SEC
to get the value in milliseconds...
Anyone? Anyone?
Regards,
Jeff
1) Yes, but you should compare the seconds value as well, you never know if the last frame took more than a second to render.
2) "man clock_gettime" seems to work well for me (under linux).
2) "man clock_gettime" seems to work well for me (under linux).
Abdulla, do you know about clock()?
This is under the mistaken impression that I KNOW about this function already...what if I want to browse around for functions starting with clock_? Then I want to see what a timespec struct is about?
quote: Original post by abdulla
2) "man clock_gettime" seems to work well for me (under linux).
This is under the mistaken impression that I KNOW about this function already...what if I want to browse around for functions starting with clock_? Then I want to see what a timespec struct is about?
then use google.
an clock(), IIRC, may return one of:
(a) time since the program started
(b) time the program has executed in the processor.
I kinda suspect (b), which would mean you get seconds of time after minutes of running... (potentially)
an clock(), IIRC, may return one of:
(a) time since the program started
(b) time the program has executed in the processor.
I kinda suspect (b), which would mean you get seconds of time after minutes of running... (potentially)
You can always do "man -a clock*", which is actually how I found it, I have no idea why I did that, guess I was bored one day.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement