Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wanted: Linux/x86 millisecond resolution timer from C.

2 views
Skip to first unread message

Edward Cane

unread,
May 7, 2002, 3:35:41 AM5/7/02
to
Hi,

I'm using C, under Linux, on a PC. I'd like to get access to a timer with
millisecond resolution.

So far, I've been using clock_t and time() from time.h, but these only give
centisecond resolution.

Are there any timers that will give less than this?

If so, any pointers to the relevant functions/include files would be great.

Many thanks,

Ed


John Hearns

unread,
May 7, 2002, 5:06:32 AM5/7/02
to

A good starting place might be chapter 5 of the OReilly
"Understanding the Linux Kernel" by Bovet and Cesati.
It goes into detail about timing measurements.

John Hearns

Cutean, Alin [CTF:4927:EXCH]

unread,
May 17, 2002, 5:53:35 AM5/17/02
to
Edward Cane wrote:

try 'man gethrtime'

best regards
alin

Karl Heyes

unread,
May 17, 2002, 11:03:05 AM5/17/02
to
On Tue, 07 May 2002 08:35:41 +0100, Edward Cane wrote:

> Hi,
>
> I'm using C, under Linux, on a PC. I'd like to get access to a timer with
> millisecond resolution.
>
> So far, I've been using clock_t and time() from time.h, but these only give
> centisecond resolution.
>
> Are there any timers that will give less than this?

as the time man page states, have a look into gettimeofday

karl.

0 new messages