:: commit 278881c72f5420adb8ec0fae1c8aa91d3cb6a621

mintsuki <mintsuki@protonmail.com> — 2025-02-16 01:58

parents: c9bf460457

protos/limine: Rename 'boot time' feature to 'date at boot' for APIv3

diff --git a/PROTOCOL.md b/PROTOCOL.md
index 429c3a71..6993889f 100644
--- a/PROTOCOL.md
+++ b/PROTOCOL.md
@@ -1262,31 +1262,31 @@ struct limine_efi_memmap_response {
 Note: This feature provides data suitable for use with RT->SetVirtualAddressMap(), provided
 HHDM offset is subtracted from `memmap`.
 
-### Boot Time Feature
+### Date at Boot Feature
 
 ID:
 ```c
-#define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
+#define LIMINE_DATE_AT_BOOT_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
 ```
 
 Request:
 ```c
-struct limine_boot_time_request {
+struct limine_date_at_boot_request {
     uint64_t id[4];
     uint64_t revision;
-    struct limine_boot_time_response *response;
+    struct limine_date_at_boot_response *response;
 };
 ```
 
 Response:
 ```c
-struct limine_boot_time_response {
+struct limine_date_at_boot_response {
     uint64_t revision;
-    int64_t boot_time;
+    int64_t timestamp;
 };
 ```
 
-* `boot_time` - The UNIX time on boot, in seconds, taken from the system RTC.
+* `timestamp` - The UNIX timestamp, in seconds, taken from the system RTC, representing the date and time of boot.
 
 ### Executable Address Feature
 
diff --git a/common/protos/limine.c b/common/protos/limine.c
index 173eb306..706dd7d4 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -1291,17 +1291,17 @@ FEAT_END
 no_fb:
     // Boot time feature
 FEAT_START
-    struct limine_boot_time_request *boot_time_request = get_request(LIMINE_BOOT_TIME_REQUEST);
-    if (boot_time_request == NULL) {
+    struct limine_date_at_boot_request *date_at_boot_request = get_request(LIMINE_DATE_AT_BOOT_REQUEST);
+    if (date_at_boot_request == NULL) {
         break; // next feature
     }
 
-    struct limine_boot_time_response *boot_time_response =
-        ext_mem_alloc(sizeof(struct limine_boot_time_response));
+    struct limine_date_at_boot_response *date_at_boot_response =
+        ext_mem_alloc(sizeof(struct limine_date_at_boot_response));
 
-    boot_time_response->boot_time = time();
+    date_at_boot_response->timestamp = time();
 
-    boot_time_request->response = reported_addr(boot_time_response);
+    date_at_boot_request->response = reported_addr(date_at_boot_response);
 FEAT_END
 
     // Wrap-up stuff before memmap close
diff --git a/limine.h b/limine.h
index d6ef458b..bfcb1855 100644
--- a/limine.h
+++ b/limine.h
@@ -635,19 +635,39 @@ struct limine_efi_memmap_request {
     LIMINE_PTR(struct limine_efi_memmap_response *) response;
 };
 
-/* Boot time */
+/* Date at boot */
 
-#define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
+#if LIMINE_API_REVISION >= 3
+#  define LIMINE_DATE_AT_BOOT_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
+#else
+#  define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
+#endif
 
+#if LIMINE_API_REVISION >= 3
+struct limine_date_at_boot_response {
+#else
 struct limine_boot_time_response {
+#endif
     uint64_t revision;
+#if LIMINE_API_REVISION >= 3
+    int64_t timestamp;
+#else
     int64_t boot_time;
+#endif
 };
 
+#if LIMINE_API_REVISION >= 3
+struct limine_date_at_boot_request {
+#else
 struct limine_boot_time_request {
+#endif
     uint64_t id[4];
     uint64_t revision;
+#if LIMINE_API_REVISION >= 3
+    LIMINE_PTR(struct limine_date_at_boot_response *) response;
+#else
     LIMINE_PTR(struct limine_boot_time_response *) response;
+#endif
 };
 
 /* Executable address */
diff --git a/test/limine.c b/test/limine.c
index 653b97c3..4d46aa79 100644
--- a/test/limine.c
+++ b/test/limine.c
@@ -113,8 +113,8 @@ static volatile struct limine_efi_memmap_request efi_memmap_request = {
 };
 
 __attribute__((section(".limine_requests")))
-static volatile struct limine_boot_time_request boot_time_request = {
-    .id = LIMINE_BOOT_TIME_REQUEST,
+static volatile struct limine_date_at_boot_request date_at_boot_request = {
+    .id = LIMINE_DATE_AT_BOOT_REQUEST,
     .revision = 0, .response = NULL
 };
 
@@ -465,13 +465,13 @@ FEAT_END
 
 FEAT_START
     e9_printf("");
-    if (boot_time_request.response == NULL) {
+    if (date_at_boot_request.response == NULL) {
         e9_printf("Boot time not passed");
         break;
     }
-    struct limine_boot_time_response *boot_time_response = boot_time_request.response;
-    e9_printf("Boot time feature, revision %d", boot_time_response->revision);
-    e9_printf("Boot time: %d", boot_time_response->boot_time);
+    struct limine_date_at_boot_response *date_at_boot_response = date_at_boot_request.response;
+    e9_printf("Date at boot feature, revision %d", date_at_boot_response->revision);
+    e9_printf("Timestamp: %d", date_at_boot_response->timestamp);
 FEAT_END
 
 // TODO: LoongArch MP
tab: 248 wrap: offon