Skip to content

Comment on Compensate for Rockchip calendar deviation on November 31stparent

Comments

But in this link isn't code setting day to Nov 1 when it hits Oct 31? Am i reading some wrong?

if (tm->tm_mon == 10 && tm->tm_mday == 31) { dev_warn(dev, "correcting Nov 31st to Dec 1st (HW bug)\n"); tm->tm_mon = 11; tm->tm_mday = 1; rk808_rtc_set_time(dev, tm); }

http://www.cplusplus.com/reference/ctime/tm/:

  Member   Type Meaning                   Range
  tm_sec   int  seconds after the minute  0-61*
  tm_min   int  minutes after the hour    0-59
  tm_hour  int  hours since midnight      0-23
  tm_mday  int  day of the month          1-31
  tm_mon   int  months since January      0-11
  tm_year  int  years since 1900	
  tm_wday  int  days since Sunday         0-6
  tm_yday  int  days since January 1      0-365
  tm_isdst int  Daylight Saving Time flag

Maybe they start counting months at zero.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.