[syslog-ng] [Bug 267] $YEAR on event in RFC 3164 format

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Wed Jan 22 16:59:38 CET 2014


https://bugzilla.balabit.com/show_bug.cgi?id=267





--- Comment #3 from splintercode <dtgarry at hotmail.com>  2014-01-22 16:59:38 ---
Thank you.

I have tested the preliminary patch, but it generation more confusion;

so for me it is not useful, and what's more it is also harmful.

please, DON'T RELEASE IT!


I think the these codes can resolve:

int getYear_GapDay(const struct tm *eventTime, const struct tm *nowtm)
{
    time_t t_eventTime, t_nowTime;

    struct tm save_eventTime = *eventTime;
    struct tm save_NowTime = *nowtm;
    int year = nowtm->tm_year;

    t_eventTime = mktime(&save_eventTime);
    t_nowTime = mktime(&save_NowTime);

    time_t seconds4Day = 60 * 60 * 24; // seconds in one day;

    // if the event time > 1 day from now
    if ((t_eventTime - t_nowTime) > (seconds4Day))
        // the year of the event is the past year;
        year--;

    return(year);
}

the eventTime parameter is the event date/time read from the event;
the nowtm is the current date/time;

it test the date of the event and if it is over 1 day of the current date, assume that the event is referring of the last year.

May be very interesting if on the macro $YEAR will be possible to pass a parameter, the number of days after it the year of the event will be the past year;
this is the value that in the test I have called "seconds4Day"

What do you think?




-- 
Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the syslog-ng mailing list