Ignore:
Timestamp:
07/18/09 05:59:22 (15 years ago)
Author:
Nicholas Riley
Message:

Maximum interval is now 999 weeks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSAlarm.m

    r366 r551  
    328328- (NSString *)intervalString;
    329329{
    330     const unsigned long long mval = 99, minute = 60, hour = minute * 60;
     330    const unsigned long long mval = 999, minute = 60, hour = minute * 60, day = hour * 24, week = day * 7;
    331331    unsigned long long interval = [self interval];
    332332    if (interval == 0) return nil;
     333
    333334    if (interval == 1) return @"One second";
    334335    if (interval == minute) return @"One minute";
     336    if (interval == hour) return @"One hour";
     337    if (interval == day) return @"One day";
     338    if (interval == week) return @"One week";
     339
     340    if (interval % week == 0) return [NSString stringWithFormat: @"%u weeks", (unsigned)(interval / week)];
     341    if (interval % day == 0) return [NSString stringWithFormat: @"%u days", (unsigned)(interval / day)];
     342    if (interval % hour == 0) return [NSString stringWithFormat: @"%u hours", (unsigned)(interval / hour)];
    335343    if (interval % minute == 0) return [NSString stringWithFormat: @"%u minutes", (unsigned)(interval / minute)];
     344   
    336345    if (interval <= mval) return [NSString stringWithFormat: @"%u seconds", (unsigned)interval];
    337     if (interval == hour) return @"One hour";
    338     if (interval % hour == 0) return [NSString stringWithFormat: @"%u hours", (unsigned)(interval / hour)];
    339346    if (interval <= mval * minute) return [NSString stringWithFormat: @"%u minutes", (unsigned)(interval / minute)];
    340347    if (interval <= mval * hour) return [NSString stringWithFormat: @"%u hours", (unsigned)(interval / hour)];
     348    if (interval <= mval * day) return [NSString stringWithFormat: @"%u days", (unsigned)(interval / day)];
     349    return [NSString stringWithFormat: @"%u weeks", (unsigned)(interval / week)];
     350
    341351    return [self _stringForInterval: interval];
    342352}
Note: See TracChangeset for help on using the changeset viewer.