Implicit Declaration of function?
Jason Price
japrice at gmail.com
Sun Dec 15 02:58:57 CET 2013
warning: implicit declaration of function ‘strptime’
I'm trying to do some basic Date parsing in Varnish. But I get this
warning on compile.
Here's the relevant bits of VCL:
C{
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
}C
sub date_skew {
C{
time_t t = time(NULL);
time_t digestepoch;
struct tm tm;
char *digestdate = VRT_GetHdr(sp, HDR_REQ, "\021x-digestdate:");
if (!strptime(digestdate, "%a, %d %b %Y %H:%M:%S GMT", &tm)) {
VRT_SetHdr(sp, HDR_REQ, "\010dateparsefail:",
"1\0", vrt_magic_string_end);
} else {
digestepoch = mktime(&tm);
if (abs(digestepoch - t) > 7200) {
VRT_SetHdr(sp, HDR_REQ,
"\010dateskewfail:", "1\0", vrt_magic_string_end);
}
}
}C
}
Note: Later on, I'll call error if either of the two headers above are set.
I've discovered that if I add:
#define _XOPEN_SOURCE 500
to the first C{ }C block, it passes muster. Any clue why? (may not be
varnish related).
Varnish related: will that impact anything else inside varnish?
--Jason
More information about the varnish-misc
mailing list