]> git.tdb.fi Git - libs/core.git/blob - source/time/unix/rawtime.cpp
Move most platform-specific code into overlay directories
[libs/core.git] / source / time / unix / rawtime.cpp
1 #include "rawtime.h"
2 #include "rawtime_private.h"
3
4 namespace Msp {
5 namespace Time {
6
7 timeval rawtime_to_timeval(RawTime raw)
8 {
9         timeval tv;
10         tv.tv_sec = raw/1000000;
11         tv.tv_usec = raw%1000000;
12         return tv;
13 }
14
15 timespec rawtime_to_timespec(RawTime raw)
16 {
17         timespec ts;
18         ts.tv_sec = raw/1000000;
19         ts.tv_nsec = (raw%1000000)*1000;
20         return ts;
21 }
22
23 RawTime timeval_to_rawtime(const timeval &tv)
24 {
25         return tv.tv_sec*1000000LL+tv.tv_usec;
26 }
27
28 } // namespace Time
29 } // namespace Msp