PICO-8 Wiki
time( )
Returns the amount of time since PICO-8 was last started, as a (fractional) number of seconds.

The time() function returns the (fractional) number of seconds since PICO-8 was started.

Technical notes[]

PICO-8's number type has an upper limit of 32767.9999 before it wraps back to -32768. This means the values from time() may become problematic after roughly 9 hours and 6 minutes. An app that needs to track elapsed times of significant duration would be wise to track time as a series of delta-times, accumulating them into a representation capable of tracking longer periods.

Time may also be measured in several different ways, and at high resolution, through the system stats. See the stat() function for details.

There is a semi-documented alias to the time() function in the form of t(). This may be useful for carts that are tight on source code space, most notably Tweetcarts.


function _init()
  last = time()

function _update()
  -- (empty update to use game loop)

function _draw()
  if (time() - last) > 10 then
    print("time's up!", 44, 60, 7)

See Also[]