From 19bd80c074e1dec35404fd85607a2a68c791b2d9 Mon Sep 17 00:00:00 2001 From: jhurst Date: Thu, 8 Oct 2009 15:58:16 +0000 Subject: FIPS 186-2 fixes --- src/KM_util.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/KM_util.cpp') diff --git a/src/KM_util.cpp b/src/KM_util.cpp index 7fcd6e3..b155362 100755 --- a/src/KM_util.cpp +++ b/src/KM_util.cpp @@ -774,6 +774,26 @@ Kumu::Timestamp::AddMinutes(i32_t minutes) } } +// +void +Kumu::Timestamp::AddSeconds(i32_t seconds) +{ + SYSTEMTIME current_st; + FILETIME current_ft; + ULARGE_INTEGER current_ul; + + if ( minutes != 0 ) + { + TIMESTAMP_TO_SYSTIME(*this, ¤t_st); + SystemTimeToFileTime(¤t_st, ¤t_ft); + memcpy(¤t_ul, ¤t_ft, sizeof(current_ul)); + current_ul.QuadPart += ( seconds_to_ns100(1) * (i64_t)seconds ); + memcpy(¤t_ft, ¤t_ul, sizeof(current_ft)); + FileTimeToSystemTime(¤t_ft, ¤t_st); + SYSTIME_TO_TIMESTAMP(¤t_st, *this); + } +} + #else // KM_WIN32 #include @@ -889,6 +909,23 @@ Kumu::Timestamp::AddMinutes(i32_t minutes) } } +// +void +Kumu::Timestamp::AddSeconds(i32_t seconds) +{ + Kumu::TAI::caltime ct; + Kumu::TAI::tai t; + + if ( seconds != 0 ) + { + TIMESTAMP_TO_CALTIME(*this, &ct) + t = ct; + t.add_seconds(seconds); + ct = t; + CALTIME_TO_TIMESTAMP(&ct, *this) + } +} + #endif // KM_WIN32 -- cgit v1.2.3