Skip to content

Commit

Permalink
fix: human time formats not accounting for speed < 1 (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-heinrich committed Mar 11, 2024
1 parent 48e0100 commit db985f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/uosc/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,21 @@ end

function update_human_times()
if state.time then
state.time_human = format_time(state.time, state.duration)
local max_seconds = state.duration
if state.duration then
local speed = state.speed or 1
if options.destination_time == 'playtime-remaining' then
state.destination_time_human = format_time((state.time - state.duration) / speed, state.duration)
max_seconds = speed >= 1 and state.duration or state.duration / speed
state.destination_time_human = format_time((state.time - state.duration) / speed, max_seconds)
elseif options.destination_time == 'total' then
state.destination_time_human = format_time(state.duration, state.duration)
state.destination_time_human = format_time(state.duration, max_seconds)
else
state.destination_time_human = format_time(state.time - state.duration, state.duration)
state.destination_time_human = format_time(state.time - state.duration, max_seconds)
end
else
state.destination_time_human = nil
end
state.time_human = format_time(state.time, max_seconds)
else
state.time_human = nil
end
Expand Down

0 comments on commit db985f1

Please sign in to comment.