aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2020-06-08 14:24:53 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2020-06-17 09:38:59 +0300
commit674360f26b6298e2c7b047ec20b1a7924a6dc682 (patch)
tree474ea1cc0386e313a4d1108ce89a8a2f8e76e131 /include
parente325856b3fc30d27481ed28ea7078e9b66e6cff4 (diff)
api: time: current time stamp in nanoseconds
Added functions to get the current local/global time stamp directly in nanoseconds. For example, odp_time_local_ns() is equivant of calling odp_time_to_ns(odp_time_local()). This simplifies use cases where time will be always converted to nanoseconds. However, when time API performance is important conversions to nanoseconds should be avoided or minimized. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Stanislaw Kardach <skardach@marvell.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'include')
-rw-r--r--include/odp/api/spec/time.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h
index c0a12064d..c5756e492 100644
--- a/include/odp/api/spec/time.h
+++ b/include/odp/api/spec/time.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2013-2018, Linaro Limited
+ * Copyright (c) 2020, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -77,6 +78,24 @@ odp_time_t odp_time_local(void);
odp_time_t odp_time_global(void);
/**
+ * Current local time in nanoseconds
+ *
+ * Like odp_time_local(), but the time stamp value is converted into nanoseconds.
+ *
+ * @return Local time stamp in nanoseconds
+ */
+uint64_t odp_time_local_ns(void);
+
+/**
+ * Current global time in nanoseconds
+ *
+ * Like odp_time_global(), but the time stamp value is converted into nanoseconds.
+ *
+ * @return Global time stamp in nanoseconds
+ */
+uint64_t odp_time_global_ns(void);
+
+/**
* Time difference
*
* @param t2 Second time stamp