TimeIntervalFormatter.m
changeset 6 2d492d8c2053
parent 0 d84d25d6cdbb
child 11 e5976864dfe9
     1.1 --- a/TimeIntervalFormatter.m	Sat Mar 08 21:04:41 2008 -0800
     1.2 +++ b/TimeIntervalFormatter.m	Fri Apr 18 09:25:10 2008 -0700
     1.3 @@ -11,6 +11,15 @@
     1.4  @implementation TimeIntervalFormatter
     1.5  
     1.6  
     1.7 +- (id) init
     1.8 +{
     1.9 +    self = [super init];
    1.10 +    if (self != nil) {
    1.11 +        _showsMinutes = YES;
    1.12 +    }
    1.13 +    return self;
    1.14 +}
    1.15 +
    1.16  - (void) awakeFromNib
    1.17  {
    1.18      _showsMinutes = YES;
    1.19 @@ -19,6 +28,14 @@
    1.20  - (void) setShowsMinutes: (BOOL)show                {_showsMinutes = show;}
    1.21  - (void) setShowsFractionalSeconds: (BOOL)show      {_showsFractionalSeconds = show;}
    1.22  
    1.23 ++ (NSString*) formatTimeInterval: (NSTimeInterval)interval
    1.24 +{
    1.25 +    TimeIntervalFormatter *fmt = [[self alloc] init];
    1.26 +    NSString *result = [fmt stringForObjectValue: [NSNumber numberWithDouble: interval]];
    1.27 +    [fmt release];
    1.28 +    return result;
    1.29 +}
    1.30 +
    1.31  
    1.32  - (NSString*) stringForObjectValue: (id)object
    1.33  {