clock(3) Library Functions Manual clock(3)Name
clock - report CPU time used
Syntax
#include <time.h>
clock_t clock ( )
CLOCKS_PER_SEC
Description
The routine returns the amount of CPU time (in microseconds) used since the first call to The time reported is the sum of the user and sys-
tem times of the calling process and its terminated child processes for which it has executed or To determine the time in seconds, the
value returned by should be divided by the value of the macro CLOCKS_PER_SEC.
The resolution of the clock is 16.667 milliseconds.
Restrictions
The value returned by is defined in microseconds for compatibility with systems that have CPU clocks with much higher resolution. Because
of this, the value returned will wrap around after accumulating only 2147 seconds of CPU time (about 36 minutes).
See Alsowait(2), times(3), system(3)clock(3)
Check Out this Related Man Page
clock(3C)clock(3C)NAME
clock() - report CPU time used
SYNOPSIS DESCRIPTION
returns the amount of CPU time (in microseconds) used since the first call to The time reported is the sum of the user and system times of
the calling process and its terminated child processes for which it has executed , or (see wait(2) , system(3S), and popen(3S)). To deter-
mine the time in seconds, the value returned by should be divided by the value of the macro
The resolution of the clock varies, depending on the hardware and on software configuration.
If the processor time used is not available or its value cannot be represented, the function returns the value
WARNINGS
The value returned by is defined in microseconds for compatibility with systems that have CPU clocks with much higher resolution. Because
of this, the value returned wraps around after accumulating only 4295 seconds of CPU time (about 72 minutes).
DEPENDENCIES
The default clock resolution is 10 milliseconds.
SEE ALSO times(2), wait(2), system(3S), thread_safety(5).
STANDARDS CONFORMANCE clock(3C)
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
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)
Hello.
I am trying to run xclock on newly built solaris box - These are the steps I followed:
# DISPLAY=localhost:0.0
# export DISPLAY
# xclock
xclock: not found
# cd /usr/openwin/bin
# ./xclock
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.
SHELL=/bin/bash
PLAYER=/usr/bin/mplayer
SONG=/home/hbar/Music/song.mp3
DISPLAY=:0.0
15 06 * * *... (10 Replies)
Hello.
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)
Hi,
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)
Hi Everybody,
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)