Hi everyone,
I'm trying to get the current time with this function and it's working fine, but, I'm getting the following warning when I compile with gcc 4.4.3 on Linux:
warning: incompatible implicit declaration of built-in function ‘strftime’
I've tried using literals for maxsize and format, but that didn't help.
Can't figure it out.
Thanks for your time,
Tom
// Function returns formatted current time
void get_current_time(char *ptr) {
struct tm *local;
time_t t;
size_t maxsize = 30;
char *format = "%2e-%2m-%Y %H:%M:%S";
t = time(NULL);
local = (void *) localtime(&t);
strftime(ptr, maxsize, format, local);
}