Improved usage of Time.now and pbGetTimeNow

This commit is contained in:
Maruno17
2023-05-17 19:24:38 +01:00
parent 28a2b7c9c1
commit 62e372f4d7
14 changed files with 49 additions and 52 deletions

View File

@@ -27,8 +27,7 @@ class BugContestState
# Returns whether the last contest ended less than 24 hours ago.
def pbContestHeld?
return false if !@lastContest
timenow = pbGetTimeNow
return timenow.to_i - @lastContest < 24 * 60 * 60 # 24 hours
return pbGetTimeNow.to_i - @lastContest < 24 * 60 * 60 # 24 hours
end
def expired?
@@ -222,8 +221,7 @@ class BugContestState
@otherparty = []
@contestMaps = []
@reception = []
timenow = pbGetTimeNow
@lastContest = timenow.to_i
@lastContest = pbGetTimeNow.to_i
$game_map.need_refresh = true
end
end

View File

@@ -320,16 +320,16 @@ def pbWriteCup(id, rules)
when 2 # Yes, use new
return if !pbConfirmMessage(_INTL("This may take a long time. Are you sure?"))
mw = pbCreateMessageWindow
t = Time.now
t = System.uptime
pbGenerateChallenge(rules, id) do |message|
if Time.now - t >= 5
if System.uptime - t >= 5
t += 5
Graphics.update
t = Time.now
end
if message
pbMessageDisplay(mw, message, false)
t = System.uptime
Graphics.update
t = Time.now
end
end
pbDisposeMessageWindow(mw)