react-native-mosquito-transport 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/MosquitoTransport.mm +13 -2
- package/package.json +1 -1
package/ios/MosquitoTransport.mm
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import "MosquitoTransport.h"
|
|
2
2
|
#import <React/RCTEventEmitter.h>
|
|
3
|
+
#import <mach/mach_time.h>
|
|
3
4
|
#if __has_include("MosquitoTransport-Swift.h")
|
|
4
5
|
#import "MosquitoTransport-Swift.h"
|
|
5
6
|
#else
|
|
@@ -50,8 +51,18 @@ RCT_EXPORT_MODULE()
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
- (void)getSystemUptime:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
static mach_timebase_info_data_t timebase;
|
|
55
|
+
if (timebase.denom == 0) {
|
|
56
|
+
mach_timebase_info(&timebase);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
uint64_t time = mach_continuous_time();
|
|
60
|
+
|
|
61
|
+
uint64_t nanos = time * timebase.numer / timebase.denom;
|
|
62
|
+
|
|
63
|
+
double milliseconds = (double)nanos / 1e6;
|
|
64
|
+
|
|
65
|
+
resolve(@(milliseconds));
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
- (void)uploadFile:(NSDictionary *)options {
|
package/package.json
CHANGED