[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT RFC PATCH] plat/common: Impliment gettimeofday function in time.c for arm64



Change-Id: If73e6ac3b068712aac4b8a82944a5aca148d70c4
---
 plat/common/arm/time.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c
index 583387b..e1bb969 100644
--- a/plat/common/arm/time.c
+++ b/plat/common/arm/time.c
@@ -38,6 +38,9 @@
 #include <uk/plat/irq.h>
 #include <uk/bitops.h>
 #include <cpu.h>
+#include <time.h>
+#include <arm/rtc.h>
+#include <arm/cpu.h>
 
 static uint64_t boot_ticks;
 static uint32_t counter_freq;
@@ -187,6 +190,23 @@ void time_block_until(__snsec until)
        }
 }
 
+/* This will get the real time in shap of timeval struct
+ * leave time zone to be added
+ */
+int gettimeofday(struct timeval *tv, void *tz)
+{
+       uint64_t nsec = ukplat_monotonic_clock();
+       tv->tv_sec = rtc_boot_seconds;
+       tv->tv_sec += ukarch_time_nsec_to_sec(nsec);
+       tv->tv_usec = ukarch_time_nsec_to_usec(ukarch_time_subsec(nsec));
+
+       if(tz != NULL) {
+               /* TODO: Timezone */
+       }
+
+       return 0;
+}
+
 /* return ns since time_init() */
 __nsec ukplat_monotonic_clock(void)
 {
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.