Skip to content

Commit

Permalink
[MobilePlayerViewController] Fix time calculation
Browse files Browse the repository at this point in the history
Fixes sahin#114
  • Loading branch information
isair committed Jan 20, 2016
1 parent a362fd0 commit 6bbb81e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions MobilePlayer/MobilePlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,14 @@ public class MobilePlayerViewController: MPMoviePlayerViewController {
if !time.isNormal {
return "00:00"
}
let hours = UInt(time / 3600)
let minutes = UInt((time / 60) % 60)
let seconds = UInt(time % 60)
let text = NSString(format: "%02lu:%02lu", minutes, seconds) as String
let hours = Int(floor(time / 3600))
let minutes = Int(floor((time / 60) % 60))
let seconds = Int(round(time % 60))
let minutesAndSeconds = NSString(format: "%02d:%02d", minutes, seconds) as String
if hours > 0 {
return NSString(format: "%02lu:%@", hours, text) as String
return NSString(format: "%02d:%@", hours, minutesAndSeconds) as String
} else {
return text
return minutesAndSeconds
}
}

Expand Down

0 comments on commit 6bbb81e

Please sign in to comment.