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

[Minios-devel] [UNIKRAFT RFC PATCH 3/5] plat/common: Implement gettimeofday function for Arm



From: Jianyong Wu <Jianyong.Wu@xxxxxxx>

Change-Id: I8efa6514970c50dfaf87d47ac10482730d76ed75
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Jianyong Wu <Jianyong.Wu@xxxxxxx>
---
 plat/common/arm/time.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c
index 9ef0417..aee9725 100644
--- a/plat/common/arm/time.c
+++ b/plat/common/arm/time.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Authors: Wei Chen <Wei.Chen@xxxxxxx>
+ *          Jianyong Wu <Jianyong.Wu@xxxxxxx>
  *
  * Copyright (c) 2018, Arm Ltd. All rights reserved.
  *
@@ -32,12 +33,14 @@
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
 #include <stdlib.h>
+#include <time.h>
 #include <libfdt.h>
 #include <uk/assert.h>
 #include <uk/plat/time.h>
 #include <uk/plat/irq.h>
 #include <uk/arch/atomic.h>
-#include <cpu.h>
+#include <arm/cpu.h>
+#include <arm/rtc.h>

 static uint64_t boot_ticks;
 static uint32_t counter_freq;
@@ -188,6 +191,20 @@ void time_block_until(__snsec until)
        }
 }

+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

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

_______________________________________________
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®.