summaryrefslogtreecommitdiff
path: root/sysutils/p5-Sys-Load/files/patch-Load.xs
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2011-01-29 20:00:32 +0000
committerSteve Wills <swills@FreeBSD.org>2011-01-29 20:00:32 +0000
commitf03648e2d817af6fcc0133a35b9bb35d39f579c6 (patch)
tree3eddcb4aff02038a75f82ab1e1947552c81278c6 /sysutils/p5-Sys-Load/files/patch-Load.xs
parent- Update to 1.78 (diff)
Sys::Load - Perl module for getting the current system load and uptime
WWW: http://search.cpan.org/dist/Sys-Load/ PR: ports/154139 Submitted by: Konstantin Menshikov <kostjnspb at yandex.ru> Approved by: pgollucci (mentor) Feature safe: yes
Notes
Notes: svn path=/head/; revision=268397
Diffstat (limited to 'sysutils/p5-Sys-Load/files/patch-Load.xs')
-rw-r--r--sysutils/p5-Sys-Load/files/patch-Load.xs27
1 files changed, 27 insertions, 0 deletions
diff --git a/sysutils/p5-Sys-Load/files/patch-Load.xs b/sysutils/p5-Sys-Load/files/patch-Load.xs
new file mode 100644
index 000000000000..4e92cc0ffd9a
--- /dev/null
+++ b/sysutils/p5-Sys-Load/files/patch-Load.xs
@@ -0,0 +1,27 @@
+--- 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)));
++ }