restore chrono timestamp

make SSK compatible with c++ by using non-modular imports, which
requires disambiguating our ddLog variable.

// FREEBIE
This commit is contained in:
Michael Kirk 2017-11-29 17:18:58 -08:00
parent 14d5950624
commit 336d59a6ce
2 changed files with 17 additions and 12 deletions

View File

@ -2,21 +2,25 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CocoaLumberjack/CocoaLumberjack.h>
#define LOG_LEVEL_DEF sskLogLevel
#define LOG_ASYNC_ENABLED YES
#ifdef DEBUG
static const NSUInteger sskLogLevel = DDLogLevelAll;
#else
static const NSUInteger sskLogLevel = DDLogLevelInfo;
#endif
#import "Asserts.h"
#import "Constraints.h"
#import "NSObject+OWS.h"
#import "OWSAnalytics.h"
#import "OWSDispatch.h"
#import "iOSVersions.h"
#import <Foundation/Foundation.h>
@import CocoaLumberjack;
#ifdef DEBUG
static const NSUInteger ddLogLevel = DDLogLevelAll;
#else
static const NSUInteger ddLogLevel = DDLogLevelInfo;
#endif
#define BLOCK_SAFE_RUN(block, ...) \
block ? dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), \

View File

@ -3,6 +3,7 @@
//
#import "NSDate+OWS.h"
#import <chrono>
NS_ASSUME_NONNULL_BEGIN
@ -10,9 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
+ (uint64_t)ows_millisecondTimeStamp
{
// FIXME SHARINGEXTENSION revert to using chrono if possible
NSDate *now = [self new];
return (uint64_t)(now.timeIntervalSince1970 * 1000);
uint64_t milliseconds
= (uint64_t)(std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1));
return milliseconds;
}
+ (NSDate *)ows_dateWithMillisecondsSince1970:(uint64_t)milliseconds