diff options
Diffstat (limited to 'src/KM_util.cpp')
| -rwxr-xr-x | src/KM_util.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
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 <time.h> @@ -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 |
