diff options
| author | jhurst <jhurst@cinecert.com> | 2012-02-21 02:09:32 +0000 |
|---|---|---|
| committer | jhurst <> | 2012-02-21 02:09:32 +0000 |
| commit | 1a5727137f5b5ff8aecd3ec5a162c198c8c0a5e7 (patch) | |
| tree | c61a1e8ba29253e51a8ebe310db2e0fad217cd78 /src/KM_tai.cpp | |
| parent | 80463afc197c90372d3f4c7890c6520f1040aedc (diff) | |
mega datetime patch
Diffstat (limited to 'src/KM_tai.cpp')
| -rw-r--r-- | src/KM_tai.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/KM_tai.cpp b/src/KM_tai.cpp index f6cbea5..4cc6c32 100644 --- a/src/KM_tai.cpp +++ b/src/KM_tai.cpp @@ -142,15 +142,8 @@ caltime_utc(Kumu::TAI::caltime* ct, const Kumu::TAI::tai* t) { assert(ct&&t); Kumu::TAI::tai t2 = *t; - ui64_t u; - i32_t s; - - /* XXX: check for overfow? */ - - u = t2.x; - - u += 58486; - s = u % ui64_C(86400); + ui64_t u = t2.x + 58486; + i32_t s = (i32_t)(u % ui64_C(86400)); ct->second = (s % 60); s /= 60; ct->minute = s % 60; s /= 60; @@ -183,11 +176,25 @@ caltime_tai(const Kumu::TAI::caltime* ct, Kumu::TAI::tai* t) void Kumu::TAI::tai::now() { +#ifdef KM_WIN32 + SYSTEMTIME st; + ::GetSystemTime(&st); + TAI::caltime ct; + ct.date.year = st.wYear; + ct.date.month = st.wMonth; + ct.date.day = st.wDay; + ct.hour = st.wHour; + ct.minute = st.wMinute; + ct.second = st.wSecond; + caltime_tai(&ct, this); +#else struct timeval now; gettimeofday(&now, 0); x = ui64_C(4611686018427387914) + (ui64_t)now.tv_sec; +#endif } + // const Kumu::TAI::tai& Kumu::TAI::tai::operator=(const Kumu::TAI::caltime& rhs) |
