Blame patches/coreutils/uptime.patch
|
|
6fc46a |
diff -ru coreutils-9.1.orig/src/uptime.c coreutils-9.1/src/uptime.c
|
|
|
6fc46a |
--- coreutils-9.1.orig/src/uptime.c 2022-04-08 13:22:18.000000000 +0200
|
|
|
6fc46a |
+++ coreutils-9.1/src/uptime.c 2023-09-06 12:26:22.909930119 +0200
|
|
|
6fc46a |
@@ -30,6 +30,11 @@
|
|
|
6fc46a |
# include <OS.h>
|
|
|
6fc46a |
#endif
|
|
|
6fc46a |
|
|
|
6fc46a |
+#ifdef __midipix__
|
|
|
6fc46a |
+#undef sa_handler
|
|
|
6fc46a |
+#include <ntapi/ntapi.h>
|
|
|
6fc46a |
+#endif
|
|
|
6fc46a |
+
|
|
|
6fc46a |
#include "c-strtod.h"
|
|
|
6fc46a |
#include "die.h"
|
|
|
6fc46a |
#include "error.h"
|
|
|
6fc46a |
@@ -59,6 +64,26 @@
|
|
|
6fc46a |
struct tm *tmn;
|
|
|
6fc46a |
double avg[3];
|
|
|
6fc46a |
int loads;
|
|
|
6fc46a |
+#ifdef __midipix__
|
|
|
6fc46a |
+ ntapi_vtbl *__ntapi;
|
|
|
6fc46a |
+ nt_system_time_of_day_information stodi;
|
|
|
6fc46a |
+
|
|
|
6fc46a |
+ if((ntapi_init(&__ntapi)) == 0)
|
|
|
6fc46a |
+ {
|
|
|
6fc46a |
+ char buf[BUFSIZ];
|
|
|
6fc46a |
+ long long nt_time;
|
|
|
6fc46a |
+ __ntapi->zw_query_system_information(NT_SYSTEM_TIME_OF_DAY_INFORMATION, &stodi, sizeof(stodi), NULL);
|
|
|
6fc46a |
+ nt_time = (stodi.current_time.quad - stodi.boot_time.quad) / 100000ULL;
|
|
|
6fc46a |
+ sprintf(buf, "%u.%02u", nt_time / 100, nt_time % 100);
|
|
|
6fc46a |
+ {
|
|
|
6fc46a |
+ char *end_ptr;
|
|
|
6fc46a |
+ double upsecs = c_strtod (buf, &end_ptr);
|
|
|
6fc46a |
+ if (buf != end_ptr)
|
|
|
6fc46a |
+ uptime = (0 <= upsecs && upsecs < TYPE_MAXIMUM (time_t)
|
|
|
6fc46a |
+ ? upsecs : -1);
|
|
|
6fc46a |
+ }
|
|
|
6fc46a |
+ }
|
|
|
6fc46a |
+#endif
|
|
|
6fc46a |
#ifdef HAVE_PROC_UPTIME
|
|
|
6fc46a |
FILE *fp;
|
|
|
6fc46a |
|