[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] hvm: Correct RTC time offset update error due to tm->tm_year





On 2012-2-21 7:54, Zhang, Yang Z wrote:
-----Original Message-----
From: young zhang [mailto:young.zhang.free@xxxxxxxxx]
Sent: Monday, February 20, 2012 11:04 PM
To: Zhang, Yang Z
Cc: ANNIE LI; xen-devel@xxxxxxxxxxxxxxxxxxx; 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@xxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.