Possible Duplicate:
What primitive data type is time_t?
Basically, all I want to do is produce the current UNIX time (result from time(NULL)) and print it to a file I have open.
I’ve tried code such as:
fprintf(f, "%i", time(NULL));
But I get these annoying compiler warnings:
src/database-createtbl.c:140: warning: int format, time_t arg (arg 3)
I’m trying to compile using -Wall – this really shouldn’t be an issue but it’s driving me nuts.
Simply cast to a known type:
The type returned by
timedepends on the OS (it’s aliased totime_t, but you don’t know if this islongorintor something else), so you need to cast it to a known type before passing it toprintf, in order for the format to match the argument type.