From the documentation: Compiler systemUptime
The amount of time the system has been awake since the last time it was restarted.
I have made some test on IPhone and I assume that the time doesn't contain the duration the phone is in deep sleep.
How I can obtain the elapsed time since the system was booted (including any time the device was in a low-power state).
My app cannot run continuously and needs to track elapsed time since the system was booted, including periods when the app is not running (e.g., during deep sleep), I'll need to rely on system APIs that provide this information accurately across app launches and system sleep states.
The date mentioned in the forum represents the boot time relative to the current system clock. This can be manipulated by the user, especially when the device is offline. While it's possible to verify if the wall clock is set correctly via NTP when online, this doesn't solve the problem entirely.
Have you actually tested this or are you just making the assumption? The manpage for clock_gettime says:
CLOCK_MONOTONIC clock that increments monotonically, tracking the time
since an arbitrary point, and will continue to increment
while the system is asleep.
Linux is one OS whose CLOCK_MONOTONIC does not increment during suspend. This behavior is allowed by POSIX, but it’s obviously much less useful, so Linux 2.6.39 added CLOCK_BOOTTIME.