[evlog-dev] [BUG] time stamp of kernel event increases improperly when timezo ne is not UTC

"Zhu, Yi" <[email protected]> Tue, 14 Jan 2003 14:46:47 +0800
Newsgroups gmane.linux.kernel.event-logging
Message-ID <[email protected]>
Hi,

When I ran the kernel test script test1.sh I got a failure. I traced the
code and found there are two pieces of code trying to adjust the kernel
message time stamp to local time in file evlogd.c lines 1275~1277 and
2794~2796.

/* Adjust timestamp to local time for kernel event */
if (logrec->rechdr.log_flags & EVL_KERNEL_EVENT) {
        logrec->rechdr.log_time.tv_sec = logrec->rechdr.log_time.tv_sec +
(tz.tz_minuteswest * 60) ;
}

But I think the entry rechdr->log_time has been set to the kernel variable
CURRENT_TIME before. CURRENT_TIME will always be the UTC time (in linux-2.4.
19/kernel/time.c line 134). In my redhat 8.0, it will set the kernel time to
UTC in /etc/rc.sysinit with /sbin/hwclock if the CMOS time is local time.
And in glibc-2.2.93-5, function localtime_r() will use tzset(3) to get the
current time zone. So I think there is no need to do this in evlogd.

Test1.sh passed after I removed those lines.

Thanks,
----------------------------------------------------------------------------
----------------------------------------------------
Opinions expressed are those of the author and do not represent Intel Corp.

Zhu Yi (Chuyee)
Intel China Software Lab (ICSL)
22nd Floor, ShanghaiMart Tower No. 2299 Yan'an Road(West) Shanghai 200336,
PRC
Tel: 8621-52574545-1261 Fax: 8621-62366119

GnuPG v1.0.6 (GNU/Linux)
http://cn.geocities.com/chewie_chuyee/gpg.txt
1024D/71C34820 C939 2B0B FBCE 1D51 109A  55E5 8650 DB90 71C3 4820


-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en