summaryrefslogtreecommitdiff
path: root/src/KM_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/KM_util.cpp')
-rwxr-xr-xsrc/KM_util.cpp37
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, &current_st);
+ SystemTimeToFileTime(&current_st, &current_ft);
+ memcpy(&current_ul, &current_ft, sizeof(current_ul));
+ current_ul.QuadPart += ( seconds_to_ns100(1) * (i64_t)seconds );
+ memcpy(&current_ft, &current_ul, sizeof(current_ft));
+ FileTimeToSystemTime(&current_ft, &current_st);
+ SYSTIME_TO_TIMESTAMP(&current_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