1
/* kern/efi/datetime.c - efi datetime function.
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2008 Free Software Foundation, Inc.
6
* GRUB is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* GRUB is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20
#include <grub/types.h>
21
#include <grub/symbol.h>
22
#include <grub/efi/api.h>
23
#include <grub/efi/efi.h>
24
#include <grub/datetime.h>
27
grub_get_datetime (struct grub_datetime *datetime)
29
grub_efi_status_t status;
30
struct grub_efi_time efi_time;
32
status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
36
return grub_error (GRUB_ERR_INVALID_COMMAND,
37
"can\'t get datetime using efi");
40
datetime->year = efi_time.year;
41
datetime->month = efi_time.month;
42
datetime->day = efi_time.day;
43
datetime->hour = efi_time.hour;
44
datetime->minute = efi_time.minute;
45
datetime->second = efi_time.second;
52
grub_set_datetime (struct grub_datetime *datetime)
54
grub_efi_status_t status;
55
struct grub_efi_time efi_time;
57
status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
61
return grub_error (GRUB_ERR_INVALID_COMMAND,
62
"can\'t get datetime using efi");
64
efi_time.year = datetime->year;
65
efi_time.month = datetime->month;
66
efi_time.day = datetime->day;
67
efi_time.hour = datetime->hour;
68
efi_time.minute = datetime->minute;
69
efi_time.second = datetime->second;
71
status = efi_call_1 (grub_efi_system_table->runtime_services->set_time,
75
return grub_error (GRUB_ERR_INVALID_COMMAND,
76
"can\'t set datetime using efi");