Re: clock_gettime() problem

From: Randy.Dunlap (rddunlap@osdl.org)
Date: Tue Apr 08 2003 - 17:57:53 EST


Hi,

I'm not quite sure why you are asking this question on the linux-net
mailing list. (?)

On Tue, 8 Apr 2003 15:30:03 -0700 "Charlie Liu" <charlie@sensoray.com> wrote:

| Hi All,
|
| Can anybody tell me what's the problem with my simple program calling
| clock_gettime() below.
|
| I have tried to compile the app under SuSE 8.1 & RedHad 7.2, but always got
| error message like:
| In Function 'main': undefined reference to 'clock_gettime'
|
| It's defined in </usr/include/time.h>. Did I miss someting alse? How to fix
| it?

It's conditionally defined in that header file. Did you check to see if
the conditions are met?

| Thank you for any hit(s).
                or hints ? :)

Sure, my number one question: what kernel version?
The answer is not SuSE 8.1 or RH 7.2. It's something like
Linux 2.4.19 or Linux 2.5.60.

| ----------------------------------------------------------------------------
| # gcc -o main main.c
|
| main.c:
|
| /*
| * This program calculates the time required to
| * execute the program specified as its first argument.
| * The time is printed in seconds, on standard out.
| */
|
| #define BILLION 1000000000L;

Lose that semi-colon there. ^

Linux 2.4.* does not implement the clock_gettime() syscall.
Patches for 2.4 POSIX clocks and timers are available at
  http://sourceforge.net/projects/high-res-timers/

These syscalls were added to Linux 2.5.64 or thereabouts, so if you
download a very recent Linux 2.5 kernel, you'll be able to use it
for these syscalls. (more recent is better.)

--
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:01 EST