forked from organicmaps/organicmaps
[ios] ETA will show time left.
This commit is contained in:
parent
8284670249
commit
520ad43b2e
1 changed files with 4 additions and 10 deletions
|
@ -5,16 +5,10 @@
|
|||
|
||||
+ (NSString *)estimatedArrivalTimeWithSeconds:(NSNumber *)seconds
|
||||
{
|
||||
static NSDateFormatter * dateFormatter;
|
||||
if (!dateFormatter)
|
||||
{
|
||||
dateFormatter = [NSDateFormatter new];
|
||||
dateFormatter.dateStyle = NSDateFormatterNoStyle;
|
||||
dateFormatter.timeStyle = NSDateFormatterShortStyle;
|
||||
}
|
||||
NSDate * date = [NSDate dateWithTimeIntervalSinceNow:[seconds floatValue]];
|
||||
NSString * string = [dateFormatter stringFromDate:date];
|
||||
return string;
|
||||
NSInteger ti = [seconds integerValue];
|
||||
NSInteger minutes = (ti / 60) % 60;
|
||||
NSInteger hours = (ti / 3600);
|
||||
return [NSString stringWithFormat:@"%ld:%02ld", (long)hours, (long)minutes];
|
||||
}
|
||||
|
||||
+ (NSDate *)dateWithString:(NSString *)dateString
|
||||
|
|
Loading…
Add table
Reference in a new issue