opnsense-ports/sysutils/p5-Sys-Load/files/patch-Load.xs
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

27 lines
523 B
Text

--- Load.xs 2002-08-31 02:00:32.000000000 +0000
+++ Load.xs 2011-01-19 12:07:14.000000000 +0000
@@ -2,6 +2,7 @@
#include "perl.h"
#include "XSUB.h"
#include "stdlib.h"
+#include <time.h>
MODULE = Sys::Load PACKAGE = Sys::Load
@@ -22,3 +23,16 @@
XPUSHs(sv_2mortal(newSVnv(load[2])));
}
+void
+uptime()
+PROTOTYPE:
+PREINIT:
+ struct timespec t;
+ int i;
+PPCODE:
+ i = clock_gettime(CLOCK_MONOTONIC, &t);
+ if(i == -1)
+ XSRETURN_EMPTY;
+ else {
+ XPUSHs(sv_2mortal(newSVnv(t.tv_sec)));
+ }