X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=inline;f=source%2Ftime%2Frawtime.cpp;fp=source%2Ftime%2Frawtime.cpp;h=0000000000000000000000000000000000000000;hb=609c9a508cfdc7b42c46c4f21d17639204165a00;hp=a299246a0fde69acfb77ed86e948e5265586c1a9;hpb=b4806214e905752617691f851717033fd3f266c2;p=libs%2Fcore.git diff --git a/source/time/rawtime.cpp b/source/time/rawtime.cpp deleted file mode 100644 index a299246..0000000 --- a/source/time/rawtime.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "rawtime.h" -#include "rawtime_private.h" - -namespace { - -#ifdef WIN32 -/// Returns the unixtime epoch as filetime -Msp::Time::RawTime get_epoch() -{ - SYSTEMTIME st; - st.wYear = 1970; - st.wMonth = 1; - st.wDay = 1; - st.wHour = 0; - st.wMinute = 0; - st.wSecond = 0; - st.wMilliseconds = 0; - - FILETIME ft; - SystemTimeToFileTime(&st, &ft); - return (ft.dwLowDateTime+(static_cast(ft.dwHighDateTime)<<32))/10; -} -#endif - -} - - -namespace Msp { -namespace Time { - -#ifdef WIN32 -RawTime filetime_to_rawtime(const FILETIME &ft) -{ - static RawTime epoch = get_epoch(); - - return (ft.dwLowDateTime+(static_cast(ft.dwHighDateTime)<<32))/10-epoch; -} -#else -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; -} -#endif - -} // namespace Time -} // namespace Msp