]> git.tdb.fi Git - libs/core.git/blobdiff - source/time/unix/rawtime.cpp
Move most platform-specific code into overlay directories
[libs/core.git] / source / time / unix / rawtime.cpp
diff --git a/source/time/unix/rawtime.cpp b/source/time/unix/rawtime.cpp
new file mode 100644 (file)
index 0000000..2b8bc6d
--- /dev/null
@@ -0,0 +1,29 @@
+#include "rawtime.h"
+#include "rawtime_private.h"
+
+namespace Msp {
+namespace Time {
+
+timeval rawtime_to_timeval(RawTime raw)
+{
+       timeval tv;
+       tv.tv_sec = raw/1000000;
+       tv.tv_usec = raw%1000000;
+       return tv;
+}
+
+timespec rawtime_to_timespec(RawTime raw)
+{
+       timespec ts;
+       ts.tv_sec = raw/1000000;
+       ts.tv_nsec = (raw%1000000)*1000;
+       return ts;
+}
+
+RawTime timeval_to_rawtime(const timeval &tv)
+{
+       return tv.tv_sec*1000000LL+tv.tv_usec;
+}
+
+} // namespace Time
+} // namespace Msp