From the manpage:
...so you may be corrupting your clock() call by running commands in system(), though it's still odd that it'd mung it that far. Try removing the system() calls and just printing the clock() values, running the program with 'time ./program' to see how your values compare to the ones time sees.
Hey ppl, i was wonddering, in mandrake, how to get the clok to display the time in non-military format....hehe thank you im just tired of looking at 18:00 hehe thank you (2 Replies)
Guys could you please tell me which appropriate command is used to set hardware (BIOS) clock so that the system keeps time when it reboots & how it's used. I use Linux
Thank you (2 Replies)
Hey all,
i need a program to get the CPU ticks at certain points of my program. So, i thought about using the clock function, but i'm having a hard time figuring out how it really works. I wrote this simple program to try to understand it but it made me feel more confused:
#include <stdio.h>... (5 Replies)
Hi,
Is there a chance that the clock() call returns 0 eternally???
Using BSD. My RTOS application freezes inconsistently only on particular hosts. When debugging it, I came to see that the RTOS timer does not tick at times. The underlying system call is clock() & it always returns zero when the... (4 Replies)
Hi
We had a AIX box built last year but was set to the correct GMT time, but using DST time zone. In march this year the clocks went forward without issues. (if I remember a couple of weeks early due to the DST zone)
This year we decided to change the clock to the correct time zone before... (0 Replies)
Hi there!!!
Need your help in solving some tricky problems.
Since clock() as such is buggy on SUN OS 5 we have started using gettimeofday() in our RTOS applications based on Solaris 9.
The problems we actually encountered previously were - the applications kind of freeze/hang eternally on... (1 Reply)
Hi all
Hi could anyone tell me how i can set the
Hardware Clock to the System Time, and set the System Time from the
Hardware Clock.
i am using RHEL 4.0.
Thanks in advance. (1 Reply)
I am trying to implement a simple chess clock. It should have the following options: start, stop, reset, read.
Reset will set the time to zero
Start will start the clock
Stop will stop the clock
My problem is that I want that start continues counting
the time from the time it had when it... (6 Replies)
Discussion started by: kristinu
6 Replies
LEARN ABOUT REDHAT
clock
CLOCK(3) Linux Programmer's Manual CLOCK(3)NAME
clock - Determine processor time
SYNOPSIS
#include <time.h>
clock_t clock(void);
DESCRIPTION
The clock() function returns an approximation of processor time used by the program.
RETURN VALUE
The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC. If the processor
time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.
CONFORMING TO
ANSI C. POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.
NOTES
The C standard allows for arbitrary values at the start of the program; subtract the value returned from a call to clock() at the start of
the program to get maximum portability.
Note that the time can wrap around. On a 32bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approx-
imately every 72 minutes.
On several other implementations, the value returned by clock() also includes the times of any children whose status has been collected via
wait() (or another wait-type call). Linux does not include the times of waited-for children in the value returned by clock(). The times()
function, which explicitly returns (separate) information about the caller and its children, may be preferable.
SEE ALSO getrusage(2), times(2)GNU 2002-06-14 CLOCK(3)