summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-06 13:30:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-06 13:37:15 +0200
commit3534cd206bedef5ea75302d9abf879b15d1df89c (patch)
tree977f646ae1282ff7f539d2a524d1e354bfcf465d /src
parent4d6f747c4b8287e042363264a47265848ca2d92c (diff)
test: speed up compile time
Removes implicit includes to <windows.h> and <cr/StringView.h> from all files. Goes from 30 to 20 seconds.
Diffstat (limited to 'src')
-rw-r--r--src/timer.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/timer.cpp b/src/timer.cpp
index c03c61d6..ad78f383 100644
--- a/src/timer.cpp
+++ b/src/timer.cpp
@@ -1,5 +1,6 @@
#include "timer.hpp"
#include "compat/assert.hpp"
+#include "compat/array-size.hpp"
#include "nanosecond.hpp"
#include <ctime>
#include <cstdio>
@@ -18,11 +19,6 @@ using Millis = duration<unsigned, std::milli>;
namespace {
-template<typename T> struct array_size_; // todo! move to compat, replace usages of arraySize & std::size_t
-template<typename T, size_t N> struct array_size_<T(&)[N]> : std::integral_constant<size_t, N> {};
-template<typename T, size_t N> struct array_size_<std::array<T, N>> : std::integral_constant<size_t, N> {};
-template<typename T> constexpr inline auto array_size = array_size_<T>::value;
-
uint64_t get_time() noexcept { return duration_cast<Nsecs>(Clock::now().time_since_epoch()).count(); }
const uint64_t Epoch = get_time();
@@ -77,7 +73,7 @@ const char* format_datetime_to_string(char (&buf)[fm_DATETIME_BUF_SIZE])
{
constexpr const char* fmt = "%a, %d %b %Y %H:%M:%S.";
constexpr size_t fmtsize = std::size("Thu 01 Mon 197000 00:00:00.");
- static_assert(array_size<decltype(buf)> - fmtsize == 4);
+ static_assert(static_array_size<decltype(buf)> - fmtsize == 4);
const auto t = SystemClock::now();
const auto ms = duration_cast<Millis>(t.time_since_epoch()) % 1000;
const auto time = SystemClock::to_time_t(t);