From 4d60fa4dc31186fff961c0a2e9c0eb01ac4226c8 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 18:47:05 +0000 Subject: [PATCH] Monotone-Parent: cbe26077e3038a934e225a1903e28b89cf90c61d Monotone-Revision: cbef49b9665bb4860d576825ae411fd212ee0d08 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T18:47:05 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ OpenChange/NSDate+MAPIStore.h | 2 ++ OpenChange/NSDate+MAPIStore.m | 13 +++++++++++++ 3 files changed, 18 insertions(+) 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