[PATCH linux] rtc: aspeed month is off-by-one
andrew at aj.id.au
Tue Jan 26 00:47:30 AEDT 2016
On Wed, 2016-01-13 at 18:50 -0600, OpenBMC Patches wrote:
> From: "Milton D. Miller II" <miltonm at us.ibm.com>
> Norm reported hwclock set the date one hour
'hour' here is meant to be 'month'? The patch only touches the month
> different from what it
> read back.
> The mktime64 call takes the month as the 1-based counted month not
> the 0-based months since January like struct rtc_tm and struct tm.
> No adjustment from the harware
WARNING: 'harware' may be misspelled - perhaps 'hardware'?
Reviewed-by: Andrew Jeffery <andrew at aj.id.au>
> is needed. Also mask off a few 0 bits.
> Reported-by: Norman James <nkskjames at gmail.com>
> Signed-off-by: Milton Miller <miltonm at us.ibm.com>
> drivers/rtc/rtc-aspeed.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> diff --git a/drivers/rtc/rtc-aspeed.c b/drivers/rtc/rtc-aspeed.c
> index cfb5ee0..1a5bbd1 100644
> --- a/drivers/rtc/rtc-aspeed.c
> +++ b/drivers/rtc/rtc-aspeed.c
> @@ -48,8 +48,7 @@ static int aspeed_rtc_read_time(struct device *dev, struct rtc_time *tm)
> > > sec = (reg1 >> 0) & 0x3f;
> > > cent = (reg2 >> 16) & 0x1f;
> > > year = (reg2 >> 8) & 0x7f;
> -> > /* struct rtc_time counts from 0 to 11, but hardware is 1 to 12 */
> -> > mon = ((reg2 >> 0) & 0x3f) - 1;
> +> > mon = (reg2 >> 0) & 0xf;> > /* mktime64 and hardware use 1 = Jan */
> > > rtc_time64_to_tm(mktime64(cent*100 + year, mon, day, hour, min, sec),
> > > > > tm);
More information about the openbmc