[MINC-users] minc-1.4 on Mac OS X 10.4.1

Sean McBride sean at rogue-research.com
Tue Aug 30 12:10:43 EDT 2005


On 2005-07-03 18:17, Steve M. Robbins said:

>> volume_io/Prog_utils/time.ovolume_io/Prog_utils/time.c: In function
>> 'get_clock_ticks_per_second':volume_io/Prog_utils/time.c:59: error:
>> 'CLK_TCK' undeclared (first use in this
>> function)volume_io/Prog_utils/time.c:59: error: (Each undeclared
>> identifier is reported only oncevolume_io/Prog_utils/time.c:59: error:
>> for each function it appears in.)make[2]: ***
>> [volume_io/Prog_utils/time.lo] Error 1make[1]: *** [all-recursive] Error
>> 1make: *** [all] Error 2
>
>Change the line in time.c that reads
>
>  clock_ticks_per_second = (Real) CLK_TCK;
>
>to
>
>  clock_ticks_per_second = (Real) sysconf( _SC_CLK_TCK );

Hello,

I just now ran into this problem myself... I was about to post, but saw
this old thread, so I am replying here.  To recap, minc 1.4 (from the
website) does not build on Mac OS X 10.4 with the default gcc 4 compiler
and headers.

I think a better fix is to change line 59 in time.c from:

 clock_ticks_per_second = (Real) CLK_TCK;

to

 clock_ticks_per_second = (Real) CLOCKS_PER_SEC;

I checked "man 3 clock" on both Mac OS X and Linux and they both say of
clock(): "to get the number of seconds used, divide by CLOCKS_PER_SEC". 
So I think dividing by CLK_TCK is simply wrong.  From the look of MINC's
current_cpu_seconds(), the idea is to get the number of seconds.  On Mac
OS X, CLK_TCK and CLOCKS_PER_SEC are the same, but maybe this is not
guaranteed.

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada





More information about the MINC-users mailing list