Skip to content

Commit dd01da0

Browse files
authoredNov 15, 2016
Add CocoaPods support (instacart#13)
Fixes instacart#5
1 parent 98a2214 commit dd01da0

File tree

7 files changed

+77
-11
lines changed

7 files changed

+77
-11
lines changed
 

‎.gitmodules

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[submodule "External/CTrueTime"]
2-
path = External/CTrueTime
3-
url = https://github.com/instacart/CTrueTime.git
4-
branch = 1.0.0
51
[submodule "External/xcconfigs"]
62
path = External/xcconfigs
73
url = https://github.com/jspahrsummers/xcconfigs.git

‎.swift-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.3

‎External/CTrueTime

-1
This file was deleted.

‎Sources/CTrueTime/module.modulemap

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module CTrueTime [system] {
2+
header "ntp_types.h"
3+
export *
4+
}

‎Sources/CTrueTime/ntp_types.h

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// ntp_types.h
3+
// TrueTime
4+
//
5+
// Created by Michael Sanders on 7/11/16.
6+
// Copyright © 2016 Instacart. All rights reserved.
7+
//
8+
9+
#ifndef NTP_TYPES_H
10+
#define NTP_TYPES_H
11+
12+
#include <stdint.h>
13+
14+
typedef struct {
15+
uint16_t whole;
16+
uint16_t fraction;
17+
} __attribute__((packed, aligned(1))) ntp_time32_t;
18+
19+
typedef struct {
20+
uint32_t whole;
21+
uint32_t fraction;
22+
} __attribute__((packed, aligned(1))) ntp_time64_t;
23+
24+
typedef ntp_time64_t ntp_time_t;
25+
26+
typedef struct {
27+
uint8_t client_mode: 3;
28+
uint8_t version_number: 3;
29+
uint8_t leap_indicator: 2;
30+
31+
uint8_t stratum;
32+
uint8_t poll;
33+
uint8_t precision;
34+
35+
ntp_time32_t root_delay;
36+
ntp_time32_t root_dispersion;
37+
uint8_t reference_id[4];
38+
39+
ntp_time_t reference_time;
40+
ntp_time_t originate_time;
41+
ntp_time_t receive_time;
42+
ntp_time_t transmit_time;
43+
} __attribute__((packed, aligned(1))) ntp_packet_t;
44+
45+
#endif /* NTP_TYPES_H */

‎TrueTime.podspec

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'TrueTime'
3+
s.version = '3.0.0'
4+
s.summary = 'NTP library for Swift. Get the true time impervious to device clock changes.'
5+
6+
s.homepage = 'https://github.com/instacart/TrueTime.swift'
7+
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
8+
s.author = { 'Michael Sanders' => 'msanders@instacart.com' }
9+
s.source = { :git => 'https://github.com/instacart/TrueTime.swift.git', :tag => s.version }
10+
11+
s.requires_arc = true
12+
s.ios.deployment_target = '8.0'
13+
s.osx.deployment_target = '10.9'
14+
s.tvos.deployment_target = '9.0'
15+
16+
s.source_files = 'Sources/*.{swift,h,m}', 'Sources/CTrueTime/*.h'
17+
s.public_header_files = 'Sources/*.h'
18+
s.pod_target_xcconfig = { 'SWIFT_INCLUDE_PATHS' => '$(SRCROOT)/TrueTime/Sources/CTrueTime/**' }
19+
s.preserve_paths = 'Sources/CTrueTime/module.modulemap'
20+
s.dependency 'Result', '~> 2.1'
21+
end

‎TrueTime.xcodeproj/project.pbxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@
11641164
PRODUCT_BUNDLE_IDENTIFIER = com.instacart.TrueTime;
11651165
PRODUCT_NAME = TrueTime;
11661166
SKIP_INSTALL = YES;
1167-
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/External/CTrueTime";
1167+
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/Sources/CTrueTime";
11681168
SWIFT_INSTALL_OBJC_HEADER = YES;
11691169
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
11701170
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -1192,7 +1192,7 @@
11921192
PRODUCT_BUNDLE_IDENTIFIER = com.instacart.TrueTime;
11931193
PRODUCT_NAME = TrueTime;
11941194
SKIP_INSTALL = YES;
1195-
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/External/CTrueTime";
1195+
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/Sources/CTrueTime";
11961196
SWIFT_INSTALL_OBJC_HEADER = YES;
11971197
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
11981198
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -1251,7 +1251,7 @@
12511251
PRODUCT_NAME = TrueTime;
12521252
SDKROOT = appletvos;
12531253
SKIP_INSTALL = YES;
1254-
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/External/CTrueTime";
1254+
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/Sources/CTrueTime";
12551255
TVOS_DEPLOYMENT_TARGET = 9.0;
12561256
};
12571257
name = Debug;
@@ -1274,7 +1274,7 @@
12741274
PRODUCT_NAME = TrueTime;
12751275
SDKROOT = appletvos;
12761276
SKIP_INSTALL = YES;
1277-
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/External/CTrueTime";
1277+
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/Sources/CTrueTime";
12781278
TVOS_DEPLOYMENT_TARGET = 9.0;
12791279
};
12801280
name = Release;
@@ -1338,7 +1338,7 @@
13381338
PRODUCT_NAME = TrueTime;
13391339
SDKROOT = macosx;
13401340
SKIP_INSTALL = YES;
1341-
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/External/CTrueTime";
1341+
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/Sources/CTrueTime";
13421342
SWIFT_INSTALL_OBJC_HEADER = YES;
13431343
};
13441344
name = Debug;
@@ -1364,7 +1364,7 @@
13641364
PRODUCT_NAME = TrueTime;
13651365
SDKROOT = macosx;
13661366
SKIP_INSTALL = YES;
1367-
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/External/CTrueTime";
1367+
SWIFT_INCLUDE_PATHS = "$(SRCROOT) $(SRCROOT)/Sources/CTrueTime";
13681368
SWIFT_INSTALL_OBJC_HEADER = YES;
13691369
};
13701370
name = Release;

0 commit comments

Comments
 (0)
Please sign in to comment.