now()
now() → timestamp
Returns the device uptime in seconds; the result carries a .sAgo() method for measuring elapsed time.
Returns seconds since boot as a floating-point number. Useful for measuring
elapsed time and for timestamping when a wall-clock time is not required (see
datetime() for calendar time).
The returned timestamp also carries a .sAgo() method giving the number
of seconds elapsed since it was taken — convenient for run-time counters and
for alarm conditions with alm.e():
let startTime = now();
// ... later ...
print("Run Time:", startTime.sAgo()); // seconds since startTime
Returns
timestamp
Uptime in seconds. Also provides .sAgo() → seconds elapsed since this timestamp was taken.
Example
let uptime = now();
print('Uptime Seconds: ',uptime);