Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

clock(3) [ultrix man page]

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 Also
       wait(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)
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX Sytem 5, release 3

Will UNIX Sytem 5, release 3 run on a Pentium (clock speed 100-200 MHz)? thanks (5 Replies)
Discussion started by: samklyle
5 Replies

2. UNIX for Dummies Questions & Answers

time clock program

How would you write a program that would continually show the time in HOURS:MINUTES on an ASCII terminal(not just xclock)? (5 Replies)
Discussion started by: Ben070371
5 Replies

3. Programming

clock() function

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)
Discussion started by: kastrup_carioca
5 Replies

4. UNIX for Advanced & Expert Users

changing sys clock (PST to UTC)

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)
Discussion started by: OFFSIHR
5 Replies

5. Solaris

run xclock from local solaris to remote solaris

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)
Discussion started by: panchpan
9 Replies

6. Solaris

Syncing server clocks in Solaris

I have several servers with different time settings. How do I sync these servers to the same time with NTP. Thanks, Remi (5 Replies)
Discussion started by: Remi
5 Replies

7. Solaris

Unable to run xclock

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)
Discussion started by: panchpan
27 Replies

8. Shell Programming and Scripting

Is this the "right" way to make an alarmclock?

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)
Discussion started by: ninjaaron
13 Replies

9. Windows & DOS: Issues & Discussions

Clock doesn't tick

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)
Discussion started by: Corona688
10 Replies

10. Shell Programming and Scripting

crontab+mplayer alarm clock

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)
Discussion started by: hbar
10 Replies

11. Shell Programming and Scripting

cron: Clock generating

Hello. I would like to do this : A_VAR_FLAG = "ABCD" +------------+...................................+---------+ ...............................|.................|...................................|.............|... (7 Replies)
Discussion started by: jcdole
7 Replies

12. Programming

Simple Chess Clock

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

13. Red Hat

Xclock command not working

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)
Discussion started by: omniok
6 Replies

14. Solaris

Help with Reviving a NETRA240 Pls?

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)
Discussion started by: ozsavran
33 Replies