Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarTime.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-03 16:04:17 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-03 16:04:17 +1000
commit11e00a8dedd8f430f6528d2852169d134c17367a (patch)
treeb8a8bb9fdf7e29f48777c0abebb3d7c8449d0a4c /source/core/StarTime.cpp
parent8ee9c97f54b210f9bb74b6a3c4f32f91b1620f13 (diff)
Change debug render time logging to use microseconds
Diffstat (limited to 'source/core/StarTime.cpp')
-rw-r--r--source/core/StarTime.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/core/StarTime.cpp b/source/core/StarTime.cpp
index abb6aae..622ea50 100644
--- a/source/core/StarTime.cpp
+++ b/source/core/StarTime.cpp
@@ -20,6 +20,10 @@ int64_t Time::monotonicMilliseconds() {
return ticksToMilliseconds(monotonicTicks(), monotonicTickFrequency());
}
+int64_t Time::monotonicMicroseconds() {
+ return ticksToMicroseconds(monotonicTicks(), monotonicTickFrequency());
+}
+
String Time::printDuration(double time) {
String hours;
String minutes;
@@ -58,6 +62,11 @@ int64_t Time::ticksToMilliseconds(int64_t ticks, int64_t tickFrequency) {
return (ticks + ticksPerMs / 2) / ticksPerMs;
}
+int64_t Time::ticksToMicroseconds(int64_t ticks, int64_t tickFrequency) {
+ int64_t ticksPerUs = (tickFrequency + 500000) / 1000000;
+ return (ticks + ticksPerUs / 2) / ticksPerUs;
+}
+
int64_t Time::secondsToTicks(double seconds, int64_t tickFrequency) {
return round(seconds * tickFrequency);
}
@@ -66,6 +75,10 @@ int64_t Time::millisecondsToTicks(int64_t milliseconds, int64_t tickFrequency) {
return milliseconds * ((tickFrequency + 500) / 1000);
}
+int64_t Time::microsecondsToTicks(int64_t microseconds, int64_t tickFrequency) {
+ return microseconds * ((tickFrequency + 500000) / 1000000);
+}
+
Clock::Clock(bool start) {
m_elapsedTicks = 0;
m_running = false;