]> git.tdb.fi Git - libs/core.git/blobdiff - source/time/rawtime.cpp
Select RawTime definition based on compiler, not platform
[libs/core.git] / source / time / rawtime.cpp
diff --git a/source/time/rawtime.cpp b/source/time/rawtime.cpp
new file mode 100644 (file)
index 0000000..427eb33
--- /dev/null
@@ -0,0 +1,25 @@
+#include "rawtime.h"
+
+namespace Msp {
+namespace Time {
+
+#ifndef WIN32
+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;
+}
+#endif
+
+} // namespace Time
+} // namespace Msp