From mboxrd@z Thu Jan 1 00:00:00 1970 From: ANNIE LI Subject: Re: [PATCH] hvm: Correct RTC time offset update error due to tm->tm_year Date: Tue, 21 Feb 2012 10:31:29 +0800 Message-ID: <4F430201.3040208@oracle.com> References: <4F41F41F.9060601@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Zhang, Yang Z" Cc: Kurt Hackel , Dan Magenheimer , "xen-devel@lists.xensource.com" , young zhang , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On 2012-2-21 7:54, Zhang, Yang Z wrote: >> -----Original Message----- >> From: young zhang [mailto:young.zhang.free@gmail.com] >> Sent: Monday, February 20, 2012 11:04 PM >> To: Zhang, Yang Z >> Cc: ANNIE LI; xen-devel@lists.xensource.com; Kurt Hackel; Dan Magenheimer; >> Konrad Rzeszutek Wilk >> Subject: Re: [Xen-devel] [PATCH] hvm: Correct RTC time offset update error due >> to tm->tm_year >> >> The mktime which used in xen is different from standard C. I think the best way is >> change it same as normal mktime, or else, other people will make the same >> mistake too. > yes. The name will mislead the people who not look into the code, including me. :) I compared the mktime of xen with mktime of linux. The code is almost the same, I do not understand why xen requires the input year is tm->tm_year, not tm->tm_year+1900. Am I missing somthing? See following diff file which is created between mktime of linux and mktime of xen, (I did some tab/space format changes for comparison) diff linux-mktime.c xen-mktime.c 2,4c2,4 < mktime(const unsigned int year0, const unsigned int mon0, < const unsigned int day, const unsigned int hour, < const unsigned int min, const unsigned int sec) --- > mktime (unsigned int year, unsigned int mon, > unsigned int day, unsigned int hour, > unsigned int min, unsigned int sec) 6,8c6 < unsigned int mon = mon0, year = year0; < < /* 1..12 -> 11,12,1..10 */ --- > /* 1..12 -> 11,12,1..10: put Feb last since it has a leap day. */ 10c8 < mon += 12; /* Puts Feb last since it has leap day */ --- > mon += 12; 21d18 < Thanks Annie > > best regards > yang > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xensource.com/xen-devel