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

Robert VINCENT bert at bic.mni.mcgill.ca
Tue Aug 30 14:28:36 EDT 2005


Hi Sean,

In addition to Steve Robbins' change (using sysconf(_SC_CLK_TCK) if
available), I have also added the following lines to the beginning of
volume_io/Prog_utils/time.c:

#ifndef CLK_TCK
#define CLK_TCK CLOCKS_PER_SEC
#endif

This should catch systems that do not define the older CLK_TCK symbol, but
do define the newer CLOCKS_PER_SEC constant.

	-bert

On Tue, 30 Aug 2005, Sean McBride wrote:

> 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
>
>
>
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>




More information about the MINC-users mailing list