Skip to content

Commit

Permalink
Merge pull request sahin#115 from mobileplayer/fix/isair-time-text
Browse files Browse the repository at this point in the history
[MobilePlayerViewController] Fix time calculation
  • Loading branch information
isair committed Jan 20, 2016
2 parents a362fd0 + 6bbb81e commit a6e82d5
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 a6e82d5

Please sign in to comment.