]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/boot-timestamps.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include "boot-timestamps.h"
9 int boot_timestamps(const dual_timestamp
*n
, dual_timestamp
*firmware
, dual_timestamp
*loader
) {
10 usec_t x
= 0, y
= 0, a
;
18 dual_timestamp_get(&_n
);
22 r
= acpi_get_boot_usec(&x
, &y
);
24 r
= efi_loader_get_boot_usec(&x
, &y
);
29 /* Let's convert this to timestamps where the firmware
30 * began/loader began working. To make this more confusing:
31 * since usec_t is unsigned and the kernel's monotonic clock
32 * begins at kernel initialization we'll actually initialize
33 * the monotonic timestamps here as negative of the actual
36 firmware
->monotonic
= y
;
37 loader
->monotonic
= y
- x
;
39 a
= n
->monotonic
+ firmware
->monotonic
;
40 firmware
->realtime
= n
->realtime
> a
? n
->realtime
- a
: 0;
42 a
= n
->monotonic
+ loader
->monotonic
;
43 loader
->realtime
= n
->realtime
> a
? n
->realtime
- a
: 0;