@@ -74,6 +74,22 @@ uint64_t since_boot_time(void)
return system_time;
}
+/* This function return the epoch time (number of seconds elapsed
+ * since Juanary 1, 1970) */
+#if defined(__i386__)
+uint32_t current_time(void)
+#else
+uint64_t current_time(void)
+#endif
+{
+#if defined(__i386__)
+ uint32_t seconds = shared_info.wc_sec;
+#else
+ uint64_t seconds = ((uint64_t)shared_info.wc_sec_hi << 32) | shared_info.wc_sec;
+#endif
+ return seconds + (since_boot_time() / 1000000000);
+}
+
/*
* Local variables:
* mode: C
@@ -11,8 +11,12 @@
#if defined(__i386__)
/* Time from boot in nanoseconds */
uint32_t since_boot_time(void);
+
+uint32_t current_time(void);
#else
uint64_t since_boot_time(void);
+
+uint64_t current_time(void);
#endif
#endif /* XTF_TIME_H */