xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: ANNIE LI <annie.li@oracle.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: Kurt Hackel <Kurt.Hackel@oracle.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	young zhang <young.zhang.free@gmail.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH] hvm: Correct RTC time offset update error due to tm->tm_year
Date: Tue, 21 Feb 2012 10:31:29 +0800	[thread overview]
Message-ID: <4F430201.3040208@oracle.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E07565C@SHSMSX101.ccr.corp.intel.com>



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

  reply	other threads:[~2012-02-21  2:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  7:19 [PATCH] hvm: Correct RTC time offset update error due to tm->tm_year ANNIE LI
2012-02-20 14:53 ` Zhang, Yang Z
2012-02-20 15:04   ` young zhang
2012-02-20 23:54     ` Zhang, Yang Z
2012-02-21  2:31       ` ANNIE LI [this message]
2012-02-22 11:05         ` Ian Campbell
2012-02-22 13:10           ` annie li
2012-02-22 13:58             ` Ian Campbell
2012-02-22 14:35               ` annie li
2012-02-23 14:52               ` annie li
2012-02-23 15:17                 ` annie li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F430201.3040208@oracle.com \
    --to=annie.li@oracle.com \
    --cc=Kurt.Hackel@oracle.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=yang.z.zhang@intel.com \
    --cc=young.zhang.free@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).