Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / common / boot / grub2 / lib / efi / datetime.c
blob9fa72fddcff791ac17d4f661059f5d42269a60a7
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/lib/datetime.h>
26 grub_err_t
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,
33 &efi_time, 0);
35 if (status)
36 return grub_error (GRUB_ERR_INVALID_COMMAND,
37 "can\'t get datetime using efi");
38 else
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;
48 return 0;
51 grub_err_t
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,
58 &efi_time, 0);
60 if (status)
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,
72 &efi_time);
74 if (status)
75 return grub_error (GRUB_ERR_INVALID_COMMAND,
76 "can\'t set datetime using efi");
78 return 0;