Skip to content

Commit

Permalink
Compare bundle times using NSTimeIntervals
Browse files Browse the repository at this point in the history
In unit tests, for some reason [NSDate isEqualToDate:] and compare: methods would sometimes fail with 2 different instances of dates with the exact same timestamp. ¯\_(ツ)_/¯
  • Loading branch information
rsattar committed Jan 28, 2016
1 parent 5f119e9 commit fd8fb90
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions LaunchKit/Classes/Bundles/LKBundlesManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ - (NSDictionary *)stateDictionary

- (void) updateServerBundlesUpdatedTimeWithTime:(NSDate *)bundlesUpdatedTime
{
if ([self.localBundlesFolderUpdatedTime isEqualToDate:bundlesUpdatedTime]) {

NSTimeInterval localTimestamp = self.localBundlesFolderUpdatedTime.timeIntervalSince1970;
NSTimeInterval serverTimestamp = bundlesUpdatedTime.timeIntervalSince1970;
if (localTimestamp == serverTimestamp) {
if (self.debugMode) {
if (self.verboseLogging) {
LKLog(@"Manifest is up-to-date, and remoteBundlesDownloaded = %d", self.remoteBundlesDownloaded);
}
}
// We have the same 'local' server time as our current, so
// mark that we have the latest, and there's nothing else to do
self.latestRemoteBundlesManifestRetrieved = YES;
Expand Down

0 comments on commit fd8fb90

Please sign in to comment.