Issue #492 resolved

love.timer.getTime unnecessary due to love.timer.getMicroTime

hahawoo avatarhahawoo created an issue

Currently, it seems that love.timer.getTime is simply a less accurate version of love.timer.getMicroTime.

The wiki says that love.timer.getTime starts at an unspecified starting time. Checking the source, love.timer.getTime seems to wrap SDL_GetTicks converted to seconds, and it makes sense that this number wouldn't quite be equal to the time that the game has been running. So I can't see why anyone would want to use love.timer.getTime instead of love.timer.getMicroTime.

I propose that love.timer.getTime be removed, and maybe that love.timer.getMicroTime claims the name love.timer.getTime, although that name kind of implies it returns the current local time.

Comments (2)

  1. Boolsheet

    love.timer.getMicroTime uses non-monotonic timers on Linux and OS X. Things can go very wrong if the user or the NTP daemon/service changes the time. SDL_GetTicks gives us a stable and monotonic timer with millisecond resolution that should work the same on all platforms.

    Edit: Apparently SDL uses a non-monotonic timer for SDL_GetTicks on OS X. That's just great.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.