CLOCK(3) BSD Library Functions Manual CLOCK(3)NAME
clock -- determine processor time used
Standard C Library (libc, -lc)
The clock() function determines the amount of processor time used since the invocation of the calling process, measured in CLOCKS_PER_SECs of
The clock() function returns the amount of time used unless an error occurs, in which case the return value is -1.
SEE ALSO getrusage(2), clocks(7)STANDARDS
The clock() function conforms to ISO/IEC 9899:1990 (``ISO C90'') and Version 3 of the Single UNIX Specification (``SUSv3'') which requires
CLOCKS_PER_SEC to be defined as one million.
BSD June 4, 1993 BSD
Check Out this Related Man Page
CLOCK(3) Linux Programmer's Manual CLOCK(3)NAME
clock - determine processor time
The clock() function returns an approximation of processor time used by the program.
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.
C89, C99, POSIX.1-2001. POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.
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 32-bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value
approximately 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(2) (or another wait-type call). Linux does not include the times of waited-for children in the value returned by clock(). The
times(2) function, which explicitly returns (separate) information about the caller and its children, may be preferable.
SEE ALSO clock_gettime(2), getrusage(2), times(2)COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2008-08-28 CLOCK(3)
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)
I'm trying to change my sys clock from PST to UTC.
I've read the man date page
it helpfully says :-
-u, --utc, --universal
print or set Coordinated Universal Time
as root I have tried date --universal, date -u, date --utc,
I have checked the /etc/sysinfo/clock file the... (5 Replies)
Hello - I am trying to connect to a remote solaris box from a solaris box i have locally present with me using 'ssh login@IP' ... Its connecting fine but... when I run xclock - it says 'Can't open display'
Whereas, IF I connect to same remote solaris IP from my windows desktop locally via putty... (9 Replies)
I am trying to run xclock on newly built solaris box - These are the steps I followed:
# export DISPLAY
xclock: not found
# cd /usr/openwin/bin
Error: Can't open display: localhost:0.0
Please suggest, what am i doing wrong?
Thank... (27 Replies)
I'm pretty unsophisticated in my scripting. I never followed a method
to learn, I just use google when I want to figure out how to use a
command or preform a certain function (and most of the results are from
here or the ABSG). Anyway, there are a lot of gaps in my knowledge.
So, I wanted... (13 Replies)
This is a strange one, I've never seen anything like it; the realtime clock doesn't tick while the computer's idle, only when you're watching it. Leave for 3 hours and it'll be 3 hours off. It still advances when it's off however, or the time would be far more incorrect than it is.
About all... (10 Replies)
I'm trying to run a alarm.sh using crontab, which play a song as
an alarm at 6.15 am. I'm using amixer so that volume increases by 10% in every loop.
My script is the following.
15 06 * * *... (10 Replies)
I would like to do this :
A_VAR_FLAG = "ABCD" +------------+...................................+---------+
...............................|.................|...................................|.............|... (7 Replies)
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)
I am using Xming tool to open the my RHEL machine remotely in UI mode. When I use xclock command using 'root', the command works properly and I can see the clock pop-up. However, when I run the 'xclock' command using oracle user I get an error, which is shown in the attached file.
Can... (6 Replies)
Hope everybody is having fun with their Solaris installations and not pulling out too much of whatever hair they have left so far. :)
Just for sport, I bought an old Netra 240 used by Northern Telecom Turkish subsidiary Netas here in Turkey. My hope is to turn this into an ugly... (33 Replies)