Input man strptimemeans that this function was to declare _XOPEN_SOURCE and include the time.h header. I have done it. But, when I try to compile my code, I get:
./check.c: 56: warning: implicit declaration of function 'strptime
Take a look at my code:
int lockExpired(const char *date, const char *format, time_t current) {
struct tm *tmp = malloc(sizeof(struct tm *));
time_t lt;
int et;
strptime(date, format, tmp);
lt = mktime(tmp);
et = difftime(current, lt);
if (et < 3600)
return -et;
return 1;
}
Also function declaration:
char *strptime(const char *s, const char *format, struct tm *tm);
Can someone tell me where my problem comes from?
source
share