lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi list,

I was unable to compile lposix.c because CLK_TCK was not defined.
Investigating in my /usr/include/time.h file, I found that:

/* This is the obsolete POSIX.1-1988 name for the same constant.  */
# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
#  ifndef CLK_TCK
#   define CLK_TCK  CLOCKS_PER_SEC
#  endif
# endif

So apparently my version of the headers (gcc 4.1.1 -- if that's the
version I should be looking at) has obsoleted CLK_TCK and uses the
constant CLOCKS_PER_SEC instead.

The fix is very easy; it suffices to add three lines in lposix.c after
the includes that define CLK_TCK if it wasn't defined. Please see
attached patch.

I don't know if this patch is applicable to everybody, i.e. should be
included in the main lposix code, but if somebody runs into the same
problem here's how to fix it!

Best,
- David

-- 
~David-Haley
http://david.the-haleys.org


--- lposix.c    2003-11-05 16:23:48.000000000 -0800
+++ lposix.c.new        2006-10-03 21:17:58.000000000 -0700
@@ -33,6 +33,10 @@
 #define MYBUFSIZ 512
 #endif

+#ifndef CLK_TCK
+ #define CLK_TCK CLOCKS_PER_SEC
+#endif
+
 #include "modemuncher.c"

 static const char *filetype(mode_t m)