c - ctime and time warnings compiling on OSX -


i getting warnings when compiling c program on osx 10.6.5, seem quite critical.

extras.c:15: warning: implicit declaration of function ‘time’ extras.c: in function ‘outlog’: extras.c:363: warning: implicit declaration of function ‘ctime’ 

the corresponding lines follows:

lines 13-15:

randnumgen = gsl_rng_alloc(gsl_rng_taus); long t1; (void) time(&t1); 

lines 360-363:

if (log==null) { log=stdout;}  tval = time(null); char* timestring = ctime(&tval); 

i believe program written linux, wonder if there difference between time , ctime on 2 platforms?

verify c files contains:

#include <time.h> 

somewhere around top.

also,

long t1; time(t1); 

is pretty lousy code, argument time() has type time_t*, should read

time_t t1; time(&t1); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -