summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/timer
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-10-22 03:46:00 +1100
committer Vas Crabb <vas@vastheman.com>2021-10-22 03:46:00 +1100
commitaa3643d5b7d7c71a790d671b3d3aca0b08281b36 (patch)
treeb856ea527dbd219927529a9b0c36febb01d943be /plugins/timer
parent6ec41305458a391b383f06fbeeeba1750c7522bc (diff)
plugins/timer: Fixed ticking when menu is left on the screen.
Diffstat (limited to 'plugins/timer')
-rw-r--r--plugins/timer/init.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/timer/init.lua b/plugins/timer/init.lua
index 07b3e20162b..eb61f85bf84 100644
--- a/plugins/timer/init.lua
+++ b/plugins/timer/init.lua
@@ -89,15 +89,21 @@ function timer.startplugin()
return string.format("%03d:%02d:%02d", hrs, min, sec)
end
+ local lastupdate
+
local function menu_populate()
- local time = os.time() - start_time
- return {{ _("Current time"), sectohms(time), "off" },
- { _("Total time"), sectohms(total_time + time), "off" },
- { _("Play Count"), play_count, "off" }}
+ lastupdate = os.time()
+ local time = lastupdate - start_time
+ return
+ {{ _("Current time"), sectohms(time), "off" },
+ { _("Total time"), sectohms(total_time + time), "off" },
+ { _("Play Count"), play_count, "off" }},
+ nil,
+ "idle"
end
local function menu_callback(index, event)
- return false
+ return os.time() > lastupdate
end
emu.register_menu(menu_callback, menu_populate, _("Timer"))