Summary: Flipper Network plugin uses timestamps for various usages e.g. start time of network requests, request duration, etc. This diff changes the origin of such timestamps. [NSDate timeIntervalSinceReferenceDate] in favour of FBMonotonicDeviceTimeGetCurrentMilliseconds(). The former uses a timestamp based on date. The latter uses the system boot time. This translates in errors when the Flipper Desktop app tries to make sense of such timestamps. This change also adds parity with the Android network plugin that uses System.currentTimeMillis(). The result is multiplied by 1000 as JavaScript expects a timestamp in millseconds. Reviewed By: fabiomassimo Differential Revision: D29029192 fbshipit-source-id: b38a4798ecf1564f5801ff3549ffeb9671fa32d6
46 lines
1.3 KiB
Objective-C
Executable File
46 lines
1.3 KiB
Objective-C
Executable File
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <Availability.h>
|
|
#import <AvailabilityInternal.h>
|
|
#import <objc/runtime.h>
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
@interface NSNumber (SonarUtility)
|
|
|
|
+ (NSNumber*)random;
|
|
|
|
@end
|
|
|
|
@interface NSDate (SonarUtility)
|
|
|
|
+ (NSTimeInterval)timestamp;
|
|
|
|
@end
|
|
|
|
@interface FLEXUtility : NSObject
|
|
|
|
// Swizzling utilities
|
|
|
|
+ (SEL)swizzledSelectorForSelector:(SEL)selector;
|
|
+ (BOOL)instanceRespondsButDoesNotImplementSelector:(SEL)selector
|
|
class:(Class)cls;
|
|
+ (void)replaceImplementationOfKnownSelector:(SEL)originalSelector
|
|
onClass:(Class)className
|
|
withBlock:(id)block
|
|
swizzledSelector:(SEL)swizzledSelector;
|
|
+ (void)replaceImplementationOfSelector:(SEL)selector
|
|
withSelector:(SEL)swizzledSelector
|
|
forClass:(Class)cls
|
|
withMethodDescription:
|
|
(struct objc_method_description)methodDescription
|
|
implementationBlock:(id)implementationBlock
|
|
undefinedBlock:(id)undefinedBlock;
|
|
|
|
@end
|