diff --git a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m index 5eac3ebf1a47..e8562e0ab118 100644 --- a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m +++ b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOApplication.m @@ -7,7 +7,8 @@ static UNOApplicationDelegate *ad; static system_theme_change_fn_ptr system_theme_change; static id device; -static NSTimeInterval uptime = 0; +static NSTimeInterval initialUptime = 0; +static NSDate *initialUptimeDate = nil; inline system_theme_change_fn_ptr uno_get_system_theme_change_callback(void) { @@ -30,10 +31,15 @@ void uno_set_system_theme_change_callback(system_theme_change_fn_ptr p) NSTimeInterval uno_get_system_uptime(void) { - if (uptime == 0) { - uptime = NSProcessInfo.processInfo.systemUptime; + if (initialUptime == 0) { + initialUptime = NSProcessInfo.processInfo.systemUptime; + initialUptimeDate = [NSDate date]; + return initialUptime; + } + else { + NSTimeInterval elapsedTime = [[NSDate date] timeIntervalSinceDate:initialUptimeDate]; + return initialUptime + elapsedTime; } - return uptime; } bool uno_app_initialize(bool *metal)