Mailinglist Archive: opensuse-bugs (8119 mails)

< Previous Next >
[Bug 249336] New: Misdefined/unused CLK_TCK in time.h?
  • From: bugzilla_noreply@xxxxxxxxxx
  • Date: Tue, 27 Feb 2007 07:33:51 -0700 (MST)
  • Message-id: <bug-249336-21960@xxxxxxxxxxxxxxxxxxxxxxxxx/>
https://bugzilla.novell.com/show_bug.cgi?id=249336

Summary: Misdefined/unused CLK_TCK in time.h?
Product: openSUSE 10.2
Version: Final
Platform: x86-64
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Development
AssignedTo: pth@xxxxxxxxxx
ReportedBy: pablomme@xxxxxxxxxxxxxx
QAContact: qa@xxxxxxx


I may well be wrong, as I'm not familiar with C development.

I found this when playing around with a Fortran 90 code which emulates the
ETIME extension via a small C module, which uses time.h and sys/times.h. The
compilation died because CLK_TCK was not defined, so I looked inside time.h and
pasted the definition back into my code [the definition was being ignored in
time.h because __STRICT_ANSI__ was defined, apparently?]:

# ifndef CLK_TCK
# define CLK_TCK CLOCKS_PER_SEC
# endif

However this gives wrong timings. I looked again at time.h and found that it
includes bits/time.h, which instead defines:

# include <bits/types.h>
extern long int __sysconf (int);
# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */

This gives the right timings in my code.

Is the definition in time.h an error? Is it actually ever processed (I would
say it is not)?

My apologies if this is not a bug, or if I should've reported it somewhere
else.


--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

< Previous Next >
Follow Ups