diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-06-09 12:15:35 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-06-25 02:13:44 +0300 |
commit | b2bd2370a25b78a7090ac701836d414cdb731bea (patch) | |
tree | c8add915914b5d963912ba61d065624d3f5ebcfa /include | |
parent | c86a6c28957a9e8e9a71582a32e96971ad411ffe (diff) | |
download | linux-b2bd2370a25b78a7090ac701836d414cdb731bea.tar.xz |
rtc: efi: use correct EFI 'epoch'
The rtc-efi driver declares that the EFI 'epoch' is 1/1/1998, but
the UEFI spec does not define it at all. It does define a range of
[1900, 9999] for the 'Year' member of the EFI_TIME struct, so let's
use 1900 as the minimum year and not 1998.
Also, move the validation of the year to the convert_from_efi_time()
routine where all other EFI_TIME fields are validated as well.
This prevents rtc_read_time() failures when the RTC that backs the
EFI time services is set to a date before 1998, e.g., when it has
lost power.
This also optimizes the compute_wday() routine, by replacing the for
loop with a simple arithmetic expression, and by reusing the yearday
value that we need to compute anyway when populating the
rtc_time::tm_yday field.
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: rtc-linux@googlegroups.com
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions