-- | Update current time in the 'ProgramState' to allow us to count
-- | frames per second rendered.
updateTime :: IORef ProgramState -> IO ()
updateTime ps = do
  programState <- get ps
  t <- utctDayTime <$> getCurrentTime
  let oldTime = programState ^. timeState . _1
  let p' = if t - oldTime >= 1
           then let allFrames = programState ^. timeState . _2
                in programState & timeState .~ (t, 0, allFrames)
           else programState

  ps $$! p' & timeState . _2 %~ succ
updateTime :: IORef ProgramState -> IO ()
updateTime ps = do
  programState <- get ps
  t <- utctDayTime <$> getCurrentTime
  let oldTime = programState ^. timeState . _1
  let p' = if t - oldTime >= 1
           then let allFrames = programState ^. timeState . _2
                in programState & timeState .~ (t, 0, allFrames)
           else programState

  ps $$! p' & timeState . _2 %~ succ
updateTime ps = do
  programState <- get ps
  t <- utctDayTime <$> getCurrentTime
  let oldTime = programState ^. timeState . _1
  let p' = if t - oldTime >= 1
           then let allFrames = programState ^. timeState . _2
                in programState & timeState .~ (t, 0, allFrames)
           else programState

  ps $$! p' & timeState . _2 %~ succ