Monotone-Parent: 0f1a6cd04afde26d6c706fce6b58bc25810d6499

Monotone-Revision: 57e9aaa5f1ddeb0f4a50965813feeb13dfbe7be7

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-08-10T17:14:44
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-08-10 17:14:44 +00:00
parent eccfda3b8b
commit 48618c8fc2
1 changed files with 48 additions and 41 deletions

View File

@ -159,30 +159,31 @@ static NSString *commaSeparator = nil;
NSTimeInterval ti;
BOOL isTime;
int val;
if (![self hasPrefix:@"P"]) {
NSLog(@"Cannot parse iCal duration value: '%@'", self);
return 0.0;
}
ti = 0.0;
val = 0;
for (i = 1, len = [self length], isTime = NO; i < len; i++) {
unichar c;
c = [self characterAtIndex:i];
if (c == 't' || c == 'T') {
ti = 0.0;
if ([self hasPrefix:@"P"])
{
val = 0;
len = [self length];
isTime = NO;
for (i = 1; i < len; i++)
{
c = [self characterAtIndex: i];
if (c == 't' || c == 'T')
{
isTime = YES;
val = 0;
continue;
}
if (isdigit(c)) {
else if (isdigit (c))
val = (val * 10) + (c - 48);
continue;
}
switch (c) {
else
{
switch (c)
{
case 'W': /* week */
ti += (val * 7 * 24 * 60 * 60);
break;
@ -202,8 +203,14 @@ static NSString *commaSeparator = nil;
[self logWithFormat: @"cannot process duration unit: '%c'", c];
break;
}
val = 0;
}
}
}
else
NSLog(@"Cannot parse iCal duration value: '%@'", self);
return ti;
}