diff --git a/ChangeLog b/ChangeLog index 8f9d93bb1..6e915207a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-03-20 Wolfgang Sourdeau + * OpenChange/NSDate+MAPIStore.m (-isNever): new accessor for dates + occurring in 4500. + * OpenChange/MAPIStoreTypes.m (MAPIChangeKeyGUIDCompare): NSData arguments passed as "id" due to the pickiness of some versions of gcc. diff --git a/OpenChange/NSDate+MAPIStore.h b/OpenChange/NSDate+MAPIStore.h index a36fb5e16..3c7809f79 100644 --- a/OpenChange/NSDate+MAPIStore.h +++ b/OpenChange/NSDate+MAPIStore.h @@ -33,6 +33,8 @@ + (id) dateFromFileTime: (const struct FILETIME *) timeValue; - (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx; +- (BOOL) isNever; /* occurs on 4500-12-31 */ + @end #endif /* NSCALENDARDATE+MAPISTORE_H */ diff --git a/OpenChange/NSDate+MAPIStore.m b/OpenChange/NSDate+MAPIStore.m index d36ff6729..1c09fd0a2 100644 --- a/OpenChange/NSDate+MAPIStore.m +++ b/OpenChange/NSDate+MAPIStore.m @@ -114,4 +114,17 @@ _setupRefDate () return timeValue; } +- (BOOL) isNever /* occurs on 4500-12-31 */ +{ + NSCalendarDate *calDate; + + if ([self isKindOfClass: [NSCalendarDate class]]) + calDate = (NSCalendarDate *) self; + else + calDate = [NSCalendarDate dateWithTimeIntervalSince1970: + [self timeIntervalSince1970]]; + + return [calDate yearOfCommonEra] == 4500; +} + @end