[syslog-ng]Re: first day of month bug?
klaas.vangend@philips.com
klaas.vangend@philips.com
Mon, 4 Feb 2002 09:30:20 +0100
Alex Howansky <alex@wankwood.com> wrote:
> Note that first file, stamped with 2001 instead of 2002. It actually contains
> entries that should have gone into 20020201. The entries in 20010201 all occur
> within the first hour of the day. It's as if the value of $YEAR is off by one
> during the first hour of the first day of a month.
If I look at the responsible code in affile.c:
if (cfg->use_time_recvd)
tm = localtime(&msg->recvd);
else
tm = localtime(&msg->stamp);
switch (id) {
case 'y':
length = snprintf(*dest, *left, "%04d", tm->tm_year + 1900);
break;
I don't see any reason for this problem, so I expect your localtime() is buggy...
(If you're familiar with C, you should be able to tell really quickly if you write some test code)
Groetjes,
Klaas van Gend