From 8149d0892b8f58902eb208a4b2c7631d9cca6bea Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 23 Mar 2024 11:15:22 -0400 Subject: [PATCH] Make Stopwatch work in comptime --- BeefLibs/corlib/src/Diagnostics/Stopwatch.bf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/BeefLibs/corlib/src/Diagnostics/Stopwatch.bf b/BeefLibs/corlib/src/Diagnostics/Stopwatch.bf index 7cde4654..9b53177c 100644 --- a/BeefLibs/corlib/src/Diagnostics/Stopwatch.bf +++ b/BeefLibs/corlib/src/Diagnostics/Stopwatch.bf @@ -113,7 +113,14 @@ namespace System.Diagnostics public static int64 GetTimestamp() { - return Internal.GetTickCountMicro(); + if (Compiler.IsComptime) + { + return (.)Platform.BfpSystem_GetTimeStamp() / 10; + } + else + { + return Internal.GetTickCountMicro(); + } } // Get the elapsed ticks.