Skip to contentSkip to conversation

s390x: Add time functions to lib

RFC Superseded Janosch Frank 1 participant 1 message Dec 18, 2018 s390

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

RFC v3 12/13 s390x: Add time functions to lib

Always good to know what time it is.

---
 lib/s390x/time.c |  18 ++++++++++
 lib/s390x/time.h | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 s390x/Makefile   |   1 +
 3 files changed, 123 insertions(+)
 create mode 100644 lib/s390x/time.c
 create mode 100644 lib/s390x/time.h
lib/s390x/time.c new file +18 -0
new file mode 100644
index 0000000..e0fbcfc
@@ -0,0 +1,18 @@
+#include <libcflat.h>
+#include "time.h"
+
+uint64_t time_get_ns(void)
+{
+	unsigned long long tod;
+
+	tod = stckf();
+	return tod_to_ns(tod);
+}
+
+uint64_t time_get_s(void)
+{
+	uint64_t ns;
+
+	ns = time_get_ns();
+	return ns / 1000000UL;
+}
lib/s390x/time.h new file +104 -0

104 lines not on this page · raw message

s390x/Makefile +1 -0
index eaad18c..f41d5be 100644
@@ -43,6 +43,7 @@ cflatobjs += lib/s390x/sclp.o
 cflatobjs += lib/s390x/sclp-console.o
 cflatobjs += lib/s390x/interrupt.o
 cflatobjs += lib/s390x/mmu.o
+cflatobjs += lib/s390x/time.o
 
 OBJDIRS += lib/s390x
 
Signature · 1 line
2.14.3