Messages in this thread | | | Date | Mon, 23 Sep 2019 22:19:38 +0200 | From | Alexandre Belloni <> | Subject | Re: [PATCH v2 1/2] rtc: wilco-ec: Remove yday and wday calculations |
| |
On 23/09/2019 11:20:42-0600, Nick Crews wrote: > > This is coming from struct tm, it is part of C89 but I think I was not > > born when this decision was made. man rtc properly reports that those > > fields are unused and no userspace tools are actually making use of > > them. Nobody cares about the broken down representation of the time. > > What is done is use the ioctl then mktime to have a UNIX timestamp. > > > > "The mktime function ignores the specified contents of the tm_wday, > > tm_yday, tm_gmtoff, and tm_zone members of the broken-down time > > structure. It uses the values of the other components to determine the > > calendar time; it’s permissible for these components to have > > unnormalized values outside their normal ranges. The last thing that > > mktime does is adjust the components of the brokentime structure, > > including the members that were initially ignored." > > This is very non-obvious and I only knew this from talking to you, > Alexandre. Perhaps we should add this note to the RTC core, > such as in the description for rtc_class_ops? >
I'm planning to add documentation on what should be done in an RTC driver, I'll ensure to add something on this topic.
> For this patch, do you want me to make any further changes? >
No need for any changes, however, I can't apply it right now because we are in the middle of the merge window.
-- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
| |