Playdate.timer value increases between calling :pause() and :start()

It looks like a timer’s value keeps updating even after it’s been paused? I expected it to not change after :pause() was called, and to only begin incrementing again after calling :start()

I put together a minimal repro - if you press A and check the console output you will see the value incrementing normally, but if you press A again, wait for a couple of seconds, and press A once more, you will notice the value has jumped as though the timer was never paused.

import 'CoreLibs/timer'

local timer =, 1, 1000)
timer.updateCallback = function ()
  print('timer update', timer.value)
timer.timerEndedCallback = function ()
  print('timer end', timer.value)

local isPlaying = false

function playdate:AButtonDown()
  if isPlaying then
    print('paused timer')
    isPlaying = false
    print('started timer')
    isPlaying = true

function playdate.update()

For now, editing CoreLibs/timer.lua so that the :start() function sets the timer’s _lastTime value back to nil seems to work:

function playdate.timer:start()
	self._lastTime = nil
	self.paused = false

Thanks for the workaround!

I’ve also reported this, a long time ago, in the days when the was an issue tracker.

Is this likely to get fixed soon?

1 Like

I've tagged Dave. Until then you can edit the lua files to add the fix yourself

I ran into this bug again on SDK 1.13.0, and it's been so long I had forgotten about it and spent a few minutes very confused in the debugger :smiling_face_with_tear:. Is a fix in the roadmap?

1 Like

Filed, and passed over to Dan :slight_smile:


I'm working on a game and I have this issue but I am not 100% sure how to edit the core libs timer file. Can you expand on how to update the core libs timer file so the timers work correctly? I looked for other threads but I cannot find anything. Appreciate any help, I have come a long way on my project just from looking at threads like this. Timers are the bane of my existence right now so I would love to get this right, I have the pause code written perfectly but my timer always resets!

There is a CoreLibs Folder in the SDK Folder. You can just open, change and save the file


Thanks Lukas, very helpful. I feel sort of stupid for not realizing that earlier, I see exactly what you mean now.

1 Like