02-06-2008
1 microsecond is the granularity of the system call, not the resolution. To obtain the resolution you should use clock_getres() if you have it. Unix systems without clock_getres() tend to have a resolution of 10 milliseconds. There is no reliable way to obtain the resolution with gettimeofday().
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
My script is reading a log file line by line
log file is like ;
19:40:22 :INFO Total time taken to Service External Request---115ms
19:40:25 DEBUG : Batch processed libdaemon.x86_64 0-0.10-5.el5 - u
19:40:22 INFO Total time taken to Service External Request---20ms
19:40:24... (4 Replies)
Discussion started by: subin_bala
4 Replies
2. UNIX for Dummies Questions & Answers
Hey. This is pretty easy stuff but I'm learning the basics of Unix at the moment so keep that in mind. I have to:
1) Write a C-shell script to monitor user activity on the server for 13 minutes.
2) Then print the smallest and largest number of users during these 13 minutes.
I have this:
1)... (2 Replies)
Discussion started by: amp10388
2 Replies
3. Programming
Hi all,
I just wrote a small problem to check gettimeofday in a multi-cores environment.
int timediff(double fTimeQvs, double fTimeTcp)
{
int iTimeDiff;
iTimeDiff = (((((int)fTimeQvs)/10000) - (((int)fTimeTcp)/10000)) * 3600) * 1000000;
iTimeDiff +=... (17 Replies)
Discussion started by: dophine
17 Replies
4. Programming
i have written the code in which i want to calculate timedifference of request sent time and response receive time from device in second and microsecond. but when i executes the binary i get the response receive time earlier than request sent time which in turn returns the negative time difference.... (3 Replies)
Discussion started by: kailas.awchar
3 Replies
5. Shell Programming and Scripting
Hey,
This is a long-shot however, I am stuck with the following problem:
I have the output from ls -la, and I want to sort some of that data out by using AWK to filter it.
ls -la | awk -f scriptname.awk
Input:
For example:
drwxr-xr-x 3 user users 4096 2010-03-14 20:15 bin/... (5 Replies)
Discussion started by: abciscool
5 Replies
6. UNIX for Dummies Questions & Answers
Which is the smallest Unix operating system and how do I download it?
edit by bakunin: corrected typo in the thread-title and removed the text formatting: we are able to read non-bold text either. (4 Replies)
Discussion started by: Nalcolmshally
4 Replies
7. Shell Programming and Scripting
Hi,
Here's my data -
aa
bb
cc
aa
dd
ee
Now I need to find the smallest block surrounded by aa & dd. Following is not helpful -
sed -n '/aa/,/dd/p' file
I need only -
aa
dd (1 Reply)
Discussion started by: nexional
1 Replies
8. Shell Programming and Scripting
Dear All,
I have input like this,
J_15TEST_ASH05_33A22.13885.txt: $$ 1 MAKE SP1501 1 1 4 6101 7392 2 2442 2685 18 3201 4008 20 120 4158
J_15TEST_ASH05_33A22.13885.txt: $$ 1 MAKE SP1502 1 1 4 5125 6416 2 ... (4 Replies)
Discussion started by: attila
4 Replies
9. Shell Programming and Scripting
Hi All
I need to find the smallest values between replicates id (column1)
Input file:
a name1 1200
a name2 800
b name1 100
b name2 150
b name3 4output:
a name2 800
b name3 4
Do you have any suggestion?
Thank you! (9 Replies)
Discussion started by: giuliangiuseppe
9 Replies
10. Shell Programming and Scripting
Input file
US Score 10
UK Ball 20
AS Score 50
AK Ball 10
PZ Ballon 50
PA Score 70
WT Data 10
.
.
Desired output file
US Score 10
AK Ball 10
WT Data 10
.
. (2 Replies)
Discussion started by: perl_beginner
2 Replies
clocks(2) System Calls Manual clocks(2)
NAME
clock_settime(), clock_gettime(), clock_getres() - clock operations
SYNOPSIS
DESCRIPTION
clock_settime()
The function sets the specified clock, to the value specified by Time values that are between two consecutive non-negative integer multi-
ples of the resolution of the specified clock are truncated down to the smaller multiple of the resolution.
clock_gettime()
The function returns the current value for the specified clock,
clock_getres()
The resolution of any clock can be obtained by calling Clock resolutions are implementation defined and are not settable by a process. If
the argument is not NULL, the resolution of the specified clock is stored into the location pointed to by If is NULL, the clock resolution
is not returned.
A clock may be system wide, that is, visible to all processes; or per-process, measuring time that is meaningful only within a process.
The following clocks are supported:
This clock represents the realtime clock for the system.
For this clock, the values returned by and specified by represent the amount of time (in seconds and nanoseconds) since
the Epoch. It is a system wide clock. The privilege is required to set this clock. Processes owned by the superuser
have this privilege. Processes owned by other users may have this privilege, depending on system configuration. See
privileges(5) for more information about privileged access on systems that support fine-grained privileges.
This clock represents the amount of time (in seconds and nanoseconds)
that the calling process has spent executing code in the user's context. It is a per-process clock. It cannot be set
by the user.
This clock represents the amount of time (in seconds and nanoseconds)
that the calling process has spent executing code in both the user's context and in the operating system on behalf of
the calling process. It is a per-process clock. It cannot be set by the user.
These clocks are high resolution hardware clocks
present on HP-RT realtime systems. It is included here so that applications accessing this hardware can be compiled on
HP-UX systems and then ported to an HP-RT target. HP-UX does not support or
RETURN VALUE
A return of zero indicates that the call succeeded. A return value of -1 indicates that an error occurred, and is set to indicate the
error.
ERRORS
If any of the following conditions occur, the and functions return -1 and set (see errno(2)) to the corresponding value:
The functions
and are not supported by this implementation.
The argument does not specify a known clock.
The argument to is outside the range for the given
The argument specified a nanosecond value less than zero or greater than or equal to 1000 million.
The requesting process does not have the necessary privileges to set the
specified clock.
The or argument points to an invalid address.
EXAMPLES
Advance the system wide realtime clock approximately one hour:
Get the resolution of the user profiling clock:
AUTHOR
and were derived from the proposed IEEE POSIX P1003.4 Standard, Draft 14.
SEE ALSO
timers(2), privileges(5).
STANDARDS CONFORMANCE
clocks(2)