Last active
December 25, 2015 14:39
-
-
Save cbess/6993054 to your computer and use it in GitHub Desktop.
Time formatted string from seconds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the human-readable string that represents the specified seconds. | |
* @discussion Ex: seconds = 4017 -> "01:06:57" | |
*/ | |
- (NSString *)timeStringFromSeconds:(NSInteger)seconds | |
{ | |
int hours = seconds / 3600; | |
int rem = seconds % 3600; | |
int minutes = rem / 60; | |
int remSecs = rem % 60; | |
return [NSString stringWithFormat:@"%.2d:%.2d:%.2d", hours, minutes, remSecs]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment