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

Hien Nguyen <[email protected]> Tue, 14 Jan 2003 12:10:42 -0800
Newsgroups gmane.linux.kernel.event-logging
Message-ID <[email protected]>
Hi Yi,

CURRENT_TIME is not always be UTC. When the system first starts up,
CURRENT_TIME = 0, little later CURRENT_TIME = CMOS time and finally
CURRENT_TIME = UTC (this happens after the kernel knows the TZ).

So what you see in evlogd.c around lines 1260-1277, basically addresses
the case when CURRENT_TIME=0 (flagged by EVL_INITIAL_BOOT_EVENT) and
CURRENT_TIME=CMOS (flagged by  EVL_KERNTIME_LOCAL, by the way I should
name this flag EVL_KERNTIME_CMOS). As you can see this code should be
around.

 The code at 2794-2796 is actual problematic and should not be there at
all (because time now should be already adjusted). It's probably a merge
error, since I did a pretty big merge for 1.5.0 version. I will fix this
  problem and do more testing on this.

Thanks, Hien.

Zhu, Yi wrote:
> 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
> _______________________________________________
> evlog-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/evlog-developers
> 




-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving 
your online business a competitive advantage. Test-drive a Thawte SSL 
certificate - our easy online guide will show you how. Click here to get 
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en