summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a5177bd)
raw | patch | inline | side by side (parent: a5177bd)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 31 Oct 2010 11:51:02 +0000 (12:51 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 31 Oct 2010 11:51:02 +0000 (12:51 +0100) |
.. and "struct timeval".
src/utils_time.h | patch | blob | history |
diff --git a/src/utils_time.h b/src/utils_time.h
index fecf5447780929c2fee24dd0c818d7d8bb1a2e40..0aa4fce64ef5c8ac9a4b32b3661819c50b9b883c 100644 (file)
--- a/src/utils_time.h
+++ b/src/utils_time.h
#define CDTIME_T_TO_DOUBLE(t) (((double) (t)) / 1073741824.0)
#define DOUBLE_TO_CDTIME_T(d) ((cdtime_t) ((d) * 1073741824.0))
-#define US_TO_CDTIME_T(us) ((cdtime_t) (((double) (us)) * 1073.741824))
-#define NS_TO_CDTIME_T(ns) ((cdtime_t) (((double) (ns)) * 1.073741824))
+#define US_TO_CDTIME_T(us) ((cdtime_t) (((double) (us)) * 1073.741824))
+#define CDTIME_T_TO_US(t) ((suseconds_t) (((double) (t)) / 1073.741824))
+#define NS_TO_CDTIME_T(ns) ((cdtime_t) (((double) (ns)) * 1.073741824))
+#define CDTIME_T_TO_NS(t) ((long) (((double) (t)) / 1.073741824))
+#define CDTIME_T_TO_TIMEVAL(t) { \
+ CDTIME_T_TO_TIME_T (t), \
+ CDTIME_T_TO_US (t % 1073741824) \
+}
#define TIMEVAL_TO_CDTIME_T(tv) (TIME_T_TO_CDTIME_T ((tv).tv_sec) \
+ US_TO_CDTIME_T ((tv).tv_usec))
+
+#define CDTIME_T_TO_TIMESPEC(t) { \
+ CDTIME_T_TO_TIME_T (t), \
+ CDTIME_T_TO_NS (t % 1073741824) \
+}
#define TIMESPEC_TO_CDTIME_T(ts) (TIME_T_TO_CDTIME_T ((ts).tv_sec) \
+ NS_TO_CDTIME_T ((ts).tv_nsec))