-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add efi_time_t and time conversion and formatting utilities
This adds the hilariously defective efi_time_t type, as well as conversion utilities to and from it, and utilities for formatted output of it. Optionally, for compatibility with older source trees, if your application defines EFIVAR_NO_EFI_TIME_T to any value other than 0, it will *not* do so, though that option may go away in some future efivar version. This allows you to turn off declaration of efi_time_t and related functions in the case where it's declared someplace else, such as in some local code or another library's headers. Signed-off-by: Peter Jones <pjones@redhat.com>
- Loading branch information
1 parent
8882f9e
commit 011f3e5
Showing
8 changed files
with
473 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: LGPL-2.1 | ||
/* | ||
* efivar-time.h | ||
* Copyright 2020 Peter Jones <pjones@redhat.com> | ||
*/ | ||
|
||
#if defined(EFIVAR_NO_EFI_TIME_T) && EFIVAR_NO_EFI_TIME_T && \ | ||
!defined(EFIVAR_TIME_H_) | ||
#define EFIVAR_TIME_H_ 1 | ||
#endif | ||
|
||
#ifndef EFIVAR_TIME_H_ | ||
#define EFIVAR_TIME_H_ 1 | ||
|
||
#include <stdbool.h> | ||
|
||
extern int tm_to_efi_time(const struct tm *const s, efi_time_t *d, bool tzadj); | ||
extern int efi_time_to_tm(const efi_time_t * const s, struct tm *d); | ||
|
||
extern char *efi_asctime(const efi_time_t *const time); | ||
extern char *efi_asctime_r(const efi_time_t *const time, char *buf); | ||
extern efi_time_t *efi_gmtime(const time_t *time); | ||
extern efi_time_t *efi_gmtime_r(const time_t *time, efi_time_t *result); | ||
extern efi_time_t *efi_localtime(const time_t *time); | ||
extern efi_time_t *efi_localtime_r(const time_t *time, efi_time_t *result); | ||
extern time_t efi_mktime(const efi_time_t *const time); | ||
|
||
extern char *efi_strptime(const char *s, const char *format, efi_time_t *time); | ||
extern size_t efi_strftime(char *s, size_t max, const char *format, | ||
const efi_time_t *time); | ||
|
||
#endif /* !EFIVAR_TIME_H_ */ | ||
// vim:fenc=utf-8:tw=75:noet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.