02-06-2008
Quote:
Originally Posted by
harsha10
Hello ...
Can somebody help telling me how smallest clock resolution on ones sytem can be in obtained in C using gettimeofday() .
Thankz in advance...
The smallest resolution for gettimeofday would be microseconds according to the manpage.
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
LEARN ABOUT OPENSOLARIS
gettimeofday
gettimeofday(3UCB) SunOS/BSD Compatibility Library Functions gettimeofday(3UCB)
NAME
gettimeofday, settimeofday - get or set the date and time
SYNOPSIS
/usr/ucb/cc [ flag ... ] file ...
#include <sys/time.h>
int gettimeofday(tp, tzp)
struct timeval *tzp;
struct timezone *tzp;
int settimeofday(tp, tzp)
struct timeval *tzp;
struct timezone *tzp;
DESCRIPTION
The system's notion of the current Greenwich time is obtained with the gettimeofday() call, and set with the settimeofday() call. The cur-
rent time is expressed in elapsed seconds and microseconds since 00:00 GMT, January 1, 1970 (zero hour). The resolution of the system clock
is hardware dependent; the time may be updated continuously, or in clock ticks.
long tv_sec; /* seconds since Jan. 1, 1970 */
long tv_usec; /* and microseconds */
tp points to a timeval structure, which includes the following members:
If tp is a NULL pointer, the current time information is not returned or set.
tzp is an obsolete pointer formerly used to get and set timezone information. tzp is now ignored. Timezone information is now handled using
the TZ environment variable; see TIMEZONE(4).
Only the privileged user may set the time of day.
RETURN VALUES
A -1 return value indicates an error occurred; in this case an error code is stored in the global variable errno.
ERRORS
The following error codes may be set in errno:
EINVAL tp specifies an invalid time.
EPERM A user other than the privileged user attempted to set the time.
SEE ALSO
cc(1B), adjtime(2), ctime(3C), gettimeofday(3C), TIMEZONE(4)
NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system
libraries or in multi-thread applications is unsupported.
tzp is ignored in SunOS 5.X releases.
tv_usec is always 0.
SunOS 5.11 30 Oct 2007 gettimeofday(3UCB)