// SPDX-License-Identifier: GPL-2.0-or-later /* * rtc-efi: RTC Class Driver for EFI-based systems * * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * * Author: dann frazier <dannf@dannf.org> * Based on efirtc.c by Stephane Eranian
*/
/* * returns day of the year [0-365]
*/ staticinlineint
compute_yday(efi_time_t *eft)
{ /* efi_time_t.month is in the [1-12] so, we need -1 */ return rtc_year_days(eft->day, eft->month - 1, eft->year);
}
/* * returns day of the week [0-6] 0=Sunday
*/ staticint
compute_wday(efi_time_t *eft, int yday)
{ int ndays = eft->year * (365 % 7)
+ (eft->year - 1) / 4
- (eft->year - 1) / 100
+ (eft->year - 1) / 400
+ yday;
/* * 1/1/0000 may or may not have been a Sunday (if it ever existed at * all) but assuming it was makes this calculation work correctly.
*/ return ndays % 7;
}
/* * As of EFI v1.10, this call always returns an unsupported status
*/
status = efi.get_wakeup_time((efi_bool_t *)&wkalrm->enabled,
(efi_bool_t *)&wkalrm->pending, &eft);
if (status != EFI_SUCCESS) return -EINVAL;
if (!convert_from_efi_time(&eft, &wkalrm->time)) return -EIO;
/* * XXX Fixme: * As of EFI 0.92 with the firmware I have on my * machine this call does not seem to work quite * right * * As of v1.10, this call always returns an unsupported status
*/
status = efi.set_wakeup_time((efi_bool_t)wkalrm->enabled, &eft);
dev_warn(dev, "write status is %d\n", (int)status);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.