Sponsored Content
Top Forums Programming smallest resolution using gettimeofday() in C Post 302165358 by shamrock on Thursday 7th of February 2008 03:34:42 PM
Old 02-07-2008
Question

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...
gettimeofday will give you the current date and time specified in seconds or microseconds from the UNIX Epoch but not the resolution of the system-wide clock so be specific as to what you want?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

checking the smallest and largest number

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

How to print largest and smallest number.

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

the problem of gettimeofday

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

Gettimeofday problem

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

AWK (how) to get smallest/largest nr of ls -la

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

Smallest UNIX operating system

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

Find the smallest block

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

Find smallest & largest in every column

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

Find smallest between replicates ID

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

Help with keep the smallest record in file

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
gettimeofday(3C)					   Standard C Library Functions 					  gettimeofday(3C)

NAME
gettimeofday, settimeofday - get or set the date and time SYNOPSIS
#include <sys/time.h> int gettimeofday(struct timeval *tp, void *tzp); int settimeofday(struct timeval *tp, void *tzp); DESCRIPTION
The gettimeofday() function gets and the settimeofday() function sets the system's notion of the current time. The current time is expressed in elapsed seconds and microseconds since 00:00 Universal Coordinated Time, January 1, 1970. The resolution of the system clock is hardware dependent; the time may be updated continuously or in clock ticks. The tp argument points to a timeval structure, which includes the following members: long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ If tp is a null pointer, the current time information is not returned or set. The TZ environment variable holds time zone information. See TIMEZONE(4). The tzp argument to gettimeofday() and settimeofday() is ignored. Only privileged processes can set the time of day. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The settimeofday() function will fail if: EINVAL The structure pointed to by tp specifies an invalid time. EPERM The {PRIV_SYS_TIME} privilege was not asserted in the effective set of the calling process. The gettimeofday() function will fail for 32-bit interfaces if: EOVERFLOW The system time has progressed beyond 2038, thus the size of the tv_sec member of the timeval structure pointed to by tp is insufficient to hold the current time in seconds. USAGE
If the tv_usec member of tp is > 500000, settimeofday() rounds the seconds upward. If the time needs to be set with better than one second accuracy, call settimeofday() for the seconds and then adjtime(2) for finer accuracy. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |gettimeofday() is Standard. | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
adjtime(2), ctime(3C), gethrtime(3C), TIMEZONE(4), attributes(5), privileges(5), standards(5) SunOS 5.10 1 Aug 2003 gettimeofday(3C)
All times are GMT -4. The time now is 07:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy