File tree 2 files changed +6
-16
lines changed
2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change 9
9
#import < Foundation/Foundation.h>
10
10
11
11
/* *
12
- Formats a time interval (provided in seconds wrapped in an NSNumber) using the following format
13
- template:
14
- 0 minutes
15
- 15 minutes
16
- 30 minutes
17
- 45 minutes
18
- 1 hour
19
- 1 hour, 15 minutes
20
- 15 hours, 30 minutes
21
- 23 hours, 45 minutes
22
- 1 day
12
+ Formats a time interval (provided in seconds wrapped in an NSNumber).
23
13
24
- @discussion This is a façade that will allow us to conditionally take advantage of OS X 10.10
25
- Yosemite's new @c NSDateIntervalFormatter when it is available.
14
+ @discussion This is a façade that will allow us to conditionally take advantage of better time
15
+ interval formatting methods as they become available.
26
16
*/
27
17
@interface SCTimeIntervalFormatter : NSFormatter
28
18
Original file line number Diff line number Diff line change @@ -34,9 +34,8 @@ - (NSString *)formatSeconds:(NSTimeInterval)seconds {
34
34
return formatted;
35
35
}
36
36
37
- - (NSString *)formatSecondsUsingModernBehavior : (NSTimeInterval )seconds {
38
- // TODO: Have this use NSDateIntervalFormatter on OS X 10.10 'Yosemite' and above.
39
-
37
+ - (NSString *)formatSecondsUsingModernBehavior : (NSTimeInterval )seconds
38
+ {
40
39
static TTTTimeIntervalFormatter* timeIntervalFormatter = nil ;
41
40
if (timeIntervalFormatter == nil ) {
42
41
timeIntervalFormatter = [[TTTTimeIntervalFormatter alloc ] init ];
@@ -56,6 +55,7 @@ - (NSString *)formatSecondsUsingModernBehavior:(NSTimeInterval)seconds {
56
55
if ([formatted length ] == 0 ) {
57
56
formatted = [self stringIndicatingZeroMinutes ];
58
57
}
58
+
59
59
return formatted;
60
60
}
61
61
You can’t perform that action at this time.
0 commit comments