From 996086e76f690c943f580ea6a17de6a5f52a5ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 15:00:08 +0900 Subject: [PATCH 01/30] Create Package.swift --- Package.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Package.swift diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..fc6ab3c --- /dev/null +++ b/Package.swift @@ -0,0 +1,23 @@ +// swift-tools-version:6.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let package = Package( + name: "TrueTime", + platforms: [ + .iOS(.v14), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "TrueTime", + targets: ["TrueTime"]), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "TrueTime", + path: "TrueTime"), + ] +) From c1100a3dd7670d8a339139a2a16993e390b4a9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 15:11:49 +0900 Subject: [PATCH 02/30] Update Package.swift --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index fc6ab3c..4e3b65a 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,6 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "TrueTime", - path: "TrueTime"), + path: "TrueTime.swift"), ] ) From 920cefbafe5dee5d239755c20cdf20431c4c7094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 15:43:20 +0900 Subject: [PATCH 03/30] Update Package.swift --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 4e3b65a..2f837c2 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,6 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "TrueTime", - path: "TrueTime.swift"), + path: "/Sources"), ] ) From d88481fb41c0b41e5ec3ea705db70aa0563ad902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 15:52:12 +0900 Subject: [PATCH 04/30] Update Package.swift --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 2f837c2..e364973 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,6 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "TrueTime", - path: "/Sources"), + dependencies: []), ] ) From a4fbb85287638d1918f3f2089978fd08fd475a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 15:58:39 +0900 Subject: [PATCH 05/30] Update Package.swift --- Package.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index e364973..847e988 100644 --- a/Package.swift +++ b/Package.swift @@ -18,6 +18,8 @@ let package = Package( // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "TrueTime", - dependencies: []), + dependencies: [], + path: "Sources", + ), ] ) From 98667c5205334055c18572cf0a92a9c5b71a59b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 16:24:56 +0900 Subject: [PATCH 06/30] Update Package.swift --- Package.swift | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Package.swift b/Package.swift index 847e988..fd5008c 100644 --- a/Package.swift +++ b/Package.swift @@ -1,25 +1,40 @@ -// swift-tools-version:6.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version: 5.0 import PackageDescription let package = Package( name: "TrueTime", platforms: [ - .iOS(.v14), + .iOS(.v8), // iOS 최소 지원 버전 + .macOS(.v10_10), // macOS 최소 지원 버전 + .tvOS(.v9) // tvOS 최소 지원 버전 ], products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. + // 이 패키지가 생성하는 라이브러리 정의 .library( name: "TrueTime", - targets: ["TrueTime"]), + targets: ["TrueTime"] + ) + ], + dependencies: [ + // 의존성이 있다면 여기에 추가합니다. ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. + // TrueTime 모듈 타겟 정의 .target( name: "TrueTime", - dependencies: [], - path: "Sources", + path: "Sources", // 소스 파일 경로 + exclude: [], // 제외할 파일(필요시 추가) + publicHeadersPath: "", // 공개 헤더가 위치한 상대 경로 + cSettings: [ + .headerSearchPath("Sources") // 헤더 파일 검색 경로 + ] ), - ] + // 테스트 타겟 정의 + .testTarget( + name: "TrueTimeTests", + dependencies: ["TrueTime"], + path: "Tests" + ) + ], + swiftLanguageVersions: [.v5] // Swift 언어 버전 설정 ) From 6d5f620cdfb4afe7f8bfc078bd0bf8d3a1b6aae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Fri, 13 Dec 2024 16:34:07 +0900 Subject: [PATCH 07/30] Update Package.swift --- Package.swift | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Package.swift b/Package.swift index fd5008c..06ab509 100644 --- a/Package.swift +++ b/Package.swift @@ -1,40 +1,36 @@ -// swift-tools-version: 5.0 +// swift-tools-version: 5.4 import PackageDescription let package = Package( name: "TrueTime", platforms: [ - .iOS(.v8), // iOS 최소 지원 버전 - .macOS(.v10_10), // macOS 최소 지원 버전 - .tvOS(.v9) // tvOS 최소 지원 버전 + .iOS(.v8), + .macOS(.v10_10), + .tvOS(.v9) ], products: [ - // 이 패키지가 생성하는 라이브러리 정의 .library( name: "TrueTime", targets: ["TrueTime"] ) ], dependencies: [ - // 의존성이 있다면 여기에 추가합니다. + // 의존성 추가 (필요 시 공백 제거) ], targets: [ - // TrueTime 모듈 타겟 정의 .target( name: "TrueTime", - path: "Sources", // 소스 파일 경로 - exclude: [], // 제외할 파일(필요시 추가) - publicHeadersPath: "", // 공개 헤더가 위치한 상대 경로 + path: "Sources", + publicHeadersPath: "", cSettings: [ - .headerSearchPath("Sources") // 헤더 파일 검색 경로 + .headerSearchPath("Sources") ] ), - // 테스트 타겟 정의 .testTarget( name: "TrueTimeTests", dependencies: ["TrueTime"], path: "Tests" ) ], - swiftLanguageVersions: [.v5] // Swift 언어 버전 설정 + swiftLanguageVersions: [.v5] ) From 34cc038675637728c4d9de05a4358af38cad4f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Mon, 16 Dec 2024 18:22:04 +0900 Subject: [PATCH 08/30] Update Package.swift --- Package.swift | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Package.swift b/Package.swift index 06ab509..809f24d 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.4 +// swift-tools-version:5.3 import PackageDescription let package = Package( @@ -14,23 +14,15 @@ let package = Package( targets: ["TrueTime"] ) ], - dependencies: [ - // 의존성 추가 (필요 시 공백 제거) - ], + dependencies: [], targets: [ .target( name: "TrueTime", path: "Sources", - publicHeadersPath: "", + publicHeadersPath: ".", cSettings: [ - .headerSearchPath("Sources") + .headerSearchPath(".") ] - ), - .testTarget( - name: "TrueTimeTests", - dependencies: ["TrueTime"], - path: "Tests" ) - ], - swiftLanguageVersions: [.v5] + ] ) From d1724aab15642323a95a6bd38aa1a7f918152cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Mon, 16 Dec 2024 19:54:03 +0900 Subject: [PATCH 09/30] Create README.md --- Sources/Swift/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Sources/Swift/README.md diff --git a/Sources/Swift/README.md b/Sources/Swift/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Sources/Swift/README.md @@ -0,0 +1 @@ + From 9a6217579688e2f16d58ef11aaf1e104bc80e4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Mon, 16 Dec 2024 19:56:54 +0900 Subject: [PATCH 10/30] Rename Sources/Endian.swift to Sources/Swift/Endian.swift --- Sources/{ => Swift}/Endian.swift | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Sources/{ => Swift}/Endian.swift (100%) diff --git a/Sources/Endian.swift b/Sources/Swift/Endian.swift similarity index 100% rename from Sources/Endian.swift rename to Sources/Swift/Endian.swift From 0067024ff78e68a6885fe96d6ded9ca78028b972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Mon, 16 Dec 2024 19:57:08 +0900 Subject: [PATCH 11/30] Rename Sources/GCDLock.swift to Sources/Swift/GCDLock.swift --- Sources/{ => Swift}/GCDLock.swift | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Sources/{ => Swift}/GCDLock.swift (100%) diff --git a/Sources/GCDLock.swift b/Sources/Swift/GCDLock.swift similarity index 100% rename from Sources/GCDLock.swift rename to Sources/Swift/GCDLock.swift From ea57084609ea5d959b8d86f9a1a98b7de7b9f038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Mon, 16 Dec 2024 20:01:15 +0900 Subject: [PATCH 12/30] =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/{ => Swift}/HostResolver.swift | 0 Sources/{ => Swift}/NTPClient.swift | 0 Sources/{ => Swift}/NTPConnection.swift | 0 Sources/{ => Swift}/NTPExtensions.swift | 0 Sources/{ => Swift}/NTPResponse.swift | 0 Sources/Swift/README.md | 1 - Sources/{ => Swift}/Reachability.swift | 0 Sources/{ => Swift}/ReferenceTime.swift | 0 Sources/{ => Swift}/SocketAddress.swift | 0 Sources/{ => Swift}/TimedOperation.swift | 0 Sources/{ => Swift}/TrueTime.swift | 0 11 files changed, 1 deletion(-) rename Sources/{ => Swift}/HostResolver.swift (100%) rename Sources/{ => Swift}/NTPClient.swift (100%) rename Sources/{ => Swift}/NTPConnection.swift (100%) rename Sources/{ => Swift}/NTPExtensions.swift (100%) rename Sources/{ => Swift}/NTPResponse.swift (100%) delete mode 100644 Sources/Swift/README.md rename Sources/{ => Swift}/Reachability.swift (100%) rename Sources/{ => Swift}/ReferenceTime.swift (100%) rename Sources/{ => Swift}/SocketAddress.swift (100%) rename Sources/{ => Swift}/TimedOperation.swift (100%) rename Sources/{ => Swift}/TrueTime.swift (100%) diff --git a/Sources/HostResolver.swift b/Sources/Swift/HostResolver.swift similarity index 100% rename from Sources/HostResolver.swift rename to Sources/Swift/HostResolver.swift diff --git a/Sources/NTPClient.swift b/Sources/Swift/NTPClient.swift similarity index 100% rename from Sources/NTPClient.swift rename to Sources/Swift/NTPClient.swift diff --git a/Sources/NTPConnection.swift b/Sources/Swift/NTPConnection.swift similarity index 100% rename from Sources/NTPConnection.swift rename to Sources/Swift/NTPConnection.swift diff --git a/Sources/NTPExtensions.swift b/Sources/Swift/NTPExtensions.swift similarity index 100% rename from Sources/NTPExtensions.swift rename to Sources/Swift/NTPExtensions.swift diff --git a/Sources/NTPResponse.swift b/Sources/Swift/NTPResponse.swift similarity index 100% rename from Sources/NTPResponse.swift rename to Sources/Swift/NTPResponse.swift diff --git a/Sources/Swift/README.md b/Sources/Swift/README.md deleted file mode 100644 index 8b13789..0000000 --- a/Sources/Swift/README.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Sources/Reachability.swift b/Sources/Swift/Reachability.swift similarity index 100% rename from Sources/Reachability.swift rename to Sources/Swift/Reachability.swift diff --git a/Sources/ReferenceTime.swift b/Sources/Swift/ReferenceTime.swift similarity index 100% rename from Sources/ReferenceTime.swift rename to Sources/Swift/ReferenceTime.swift diff --git a/Sources/SocketAddress.swift b/Sources/Swift/SocketAddress.swift similarity index 100% rename from Sources/SocketAddress.swift rename to Sources/Swift/SocketAddress.swift diff --git a/Sources/TimedOperation.swift b/Sources/Swift/TimedOperation.swift similarity index 100% rename from Sources/TimedOperation.swift rename to Sources/Swift/TimedOperation.swift diff --git a/Sources/TrueTime.swift b/Sources/Swift/TrueTime.swift similarity index 100% rename from Sources/TrueTime.swift rename to Sources/Swift/TrueTime.swift From 4619ecaef0c8bc05046c24d809542734887adff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Mon, 16 Dec 2024 20:02:01 +0900 Subject: [PATCH 13/30] Update Package.swift --- Package.swift | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Package.swift b/Package.swift index 809f24d..ca88b75 100644 --- a/Package.swift +++ b/Package.swift @@ -4,9 +4,9 @@ import PackageDescription let package = Package( name: "TrueTime", platforms: [ - .iOS(.v8), - .macOS(.v10_10), - .tvOS(.v9) + .iOS(.v10), // iOS 10.0 이상 지원 + .macOS(.v10_15), // macOS 10.15 이상 지원 + .tvOS(.v10) // tvOS 10.0 이상 지원 ], products: [ .library( @@ -16,13 +16,21 @@ let package = Package( ], dependencies: [], targets: [ + // Objective-C 모듈 타겟 .target( - name: "TrueTime", - path: "Sources", + name: "CTrueTime", + path: "Sources/CTrueTime", publicHeadersPath: ".", cSettings: [ - .headerSearchPath(".") + .headerSearchPath("."), + .define("USE_OBJC_CODE") // 필요한 경우 정의 플래그 추가 ] + ), + // Swift 모듈 타겟 + .target( + name: "TrueTime", + dependencies: ["CTrueTime"], + path: "Sources/Swift" ) ] ) From ebae5320178c8c8b426ad642d9a729502cb208f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 12:17:01 +0900 Subject: [PATCH 14/30] Update Package.swift --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index ca88b75..401de86 100644 --- a/Package.swift +++ b/Package.swift @@ -20,9 +20,9 @@ let package = Package( .target( name: "CTrueTime", path: "Sources/CTrueTime", - publicHeadersPath: ".", + publicHeadersPath: "include", cSettings: [ - .headerSearchPath("."), + .headerSearchPath("include"), .define("USE_OBJC_CODE") // 필요한 경우 정의 플래그 추가 ] ), From c1cf405bc2646d079f6a1cab26e9de210f01192c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 14:34:08 +0900 Subject: [PATCH 15/30] Update Package.swift --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 401de86..ca88b75 100644 --- a/Package.swift +++ b/Package.swift @@ -20,9 +20,9 @@ let package = Package( .target( name: "CTrueTime", path: "Sources/CTrueTime", - publicHeadersPath: "include", + publicHeadersPath: ".", cSettings: [ - .headerSearchPath("include"), + .headerSearchPath("."), .define("USE_OBJC_CODE") // 필요한 경우 정의 플래그 추가 ] ), From eb178f311e725278754c787aeffcf3cc750fd7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:04:48 +0900 Subject: [PATCH 16/30] Update Package.swift --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index ca88b75..9f5ef03 100644 --- a/Package.swift +++ b/Package.swift @@ -22,7 +22,7 @@ let package = Package( path: "Sources/CTrueTime", publicHeadersPath: ".", cSettings: [ - .headerSearchPath("."), + .headerSearchPath("Sources/CTrueTime"), .define("USE_OBJC_CODE") // 필요한 경우 정의 플래그 추가 ] ), From ccadcf1b00257cd8022d0dfb986d4cffb93685f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:10:21 +0900 Subject: [PATCH 17/30] Update module.modulemap --- Sources/CTrueTime/module.modulemap | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/CTrueTime/module.modulemap b/Sources/CTrueTime/module.modulemap index 75108b7..52e6486 100644 --- a/Sources/CTrueTime/module.modulemap +++ b/Sources/CTrueTime/module.modulemap @@ -1,4 +1,5 @@ module CTrueTime [system] { - header "ntp_types.h" - export * + umbrella header "ntp_types.h" + export * + module * { export * } } From d88224d44d1a817df3f6140fdd098cb4241d161b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:21:32 +0900 Subject: [PATCH 18/30] Update module.modulemap --- Sources/CTrueTime/module.modulemap | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sources/CTrueTime/module.modulemap b/Sources/CTrueTime/module.modulemap index 52e6486..75108b7 100644 --- a/Sources/CTrueTime/module.modulemap +++ b/Sources/CTrueTime/module.modulemap @@ -1,5 +1,4 @@ module CTrueTime [system] { - umbrella header "ntp_types.h" - export * - module * { export * } + header "ntp_types.h" + export * } From 104ec465fbadf8c7ea617aeaf5761b53e2cc4a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:40:37 +0900 Subject: [PATCH 19/30] Update Package.swift --- Package.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 9f5ef03..7ac95ce 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,12 @@ let package = Package( publicHeadersPath: ".", cSettings: [ .headerSearchPath("Sources/CTrueTime"), - .define("USE_OBJC_CODE") // 필요한 경우 정의 플래그 추가 + .define("USE_OBJC_CODE"), + .define("HAVE_TIMEGM", to: "1"), + .define("HAVE_CLOCK_GETTIME", to: "1") + ], + linkerSettings: [ + .linkedLibrary("m") ] ), // Swift 모듈 타겟 From b72bd4d97defd39001165dbb7643318382ce9685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:43:44 +0900 Subject: [PATCH 20/30] Update Package.swift --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 7ac95ce..f2f44cc 100644 --- a/Package.swift +++ b/Package.swift @@ -20,9 +20,9 @@ let package = Package( .target( name: "CTrueTime", path: "Sources/CTrueTime", - publicHeadersPath: ".", + publicHeadersPath: "include", cSettings: [ - .headerSearchPath("Sources/CTrueTime"), + .headerSearchPath("Sources/CTrueTime/include"), .define("USE_OBJC_CODE"), .define("HAVE_TIMEGM", to: "1"), .define("HAVE_CLOCK_GETTIME", to: "1") From f80de17e3a6950389fa4442ef3e41984d6e4cfe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:44:03 +0900 Subject: [PATCH 21/30] Rename Sources/CTrueTime/ntp_types.h to Sources/CTrueTime/include/ntp_types.h --- Sources/CTrueTime/{ => include}/ntp_types.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Sources/CTrueTime/{ => include}/ntp_types.h (100%) diff --git a/Sources/CTrueTime/ntp_types.h b/Sources/CTrueTime/include/ntp_types.h similarity index 100% rename from Sources/CTrueTime/ntp_types.h rename to Sources/CTrueTime/include/ntp_types.h From 089c0ed184348c940ebe9bb110fd60bf54a9d11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 15:50:01 +0900 Subject: [PATCH 22/30] Update Package.swift --- Package.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index f2f44cc..8a5f85d 100644 --- a/Package.swift +++ b/Package.swift @@ -35,7 +35,10 @@ let package = Package( .target( name: "TrueTime", dependencies: ["CTrueTime"], - path: "Sources/Swift" + path: "Sources/Swift", + swiftSettings: [ + .define("SWIFT_PACKAGE") + ] ) ] ) From 76064c96909b7608ac1f0648b9ffedbe6e0e3c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 16:52:25 +0900 Subject: [PATCH 23/30] Update Package.swift --- Package.swift | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Package.swift b/Package.swift index 8a5f85d..6d0822a 100644 --- a/Package.swift +++ b/Package.swift @@ -22,13 +22,8 @@ let package = Package( path: "Sources/CTrueTime", publicHeadersPath: "include", cSettings: [ - .headerSearchPath("Sources/CTrueTime/include"), - .define("USE_OBJC_CODE"), - .define("HAVE_TIMEGM", to: "1"), - .define("HAVE_CLOCK_GETTIME", to: "1") - ], - linkerSettings: [ - .linkedLibrary("m") + .headerSearchPath("include"), + .define("USE_OBJC_CODE") ] ), // Swift 모듈 타겟 From 094b9151430a02ea13d8fa8c906d0133d12e92e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 16:55:37 +0900 Subject: [PATCH 24/30] Create module.modulemap --- Sources/CTrueTime/include/module.modulemap | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Sources/CTrueTime/include/module.modulemap diff --git a/Sources/CTrueTime/include/module.modulemap b/Sources/CTrueTime/include/module.modulemap new file mode 100644 index 0000000..32ece5d --- /dev/null +++ b/Sources/CTrueTime/include/module.modulemap @@ -0,0 +1,5 @@ +module CTrueTime { + umbrella header "ntp_types.h" + export * + module * { export * } +} From bbadfab68c4e848c5de5803b0b79ca11c827d4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B2=BD=EC=9A=B0?= Date: Wed, 18 Dec 2024 16:57:00 +0900 Subject: [PATCH 25/30] Update Package.swift --- Package.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index 6d0822a..f101fea 100644 --- a/Package.swift +++ b/Package.swift @@ -23,17 +23,13 @@ let package = Package( publicHeadersPath: "include", cSettings: [ .headerSearchPath("include"), - .define("USE_OBJC_CODE") ] ), // Swift 모듈 타겟 .target( name: "TrueTime", dependencies: ["CTrueTime"], - path: "Sources/Swift", - swiftSettings: [ - .define("SWIFT_PACKAGE") - ] + path: "Sources/Swift" ) ] ) From a8a2c5196c921af15d061b8722ec7dc48047223e Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Wed, 18 Dec 2024 17:39:08 +0900 Subject: [PATCH 26/30] =?UTF-8?q?Package.swift=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=ED=8E=B8=EC=A7=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 6148 bytes .../contents.xcworkspacedata | 7 ++ Package.resolved | 61 ++++++++++++++++++ Package.swift | 20 ++++-- 4 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 .DS_Store create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 Package.resolved diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cc7836c95456bd6f359f856cbd6e6dd04fa09559 GIT binary patch literal 6148 zcmeHKOG*Pl5UtWI2Hb?KT=ofs++Ylo6C`^j88J$R9)y69&1~IyD)AN`z)Se*qhxRv z!G(xaLD#G9s_N-}Fx_25#Is#JB^nb^fhNde42TR5x=uWJ1Z16KNq5xH4PDUVz(jv> zNY*}~B|Xp%>poonnljZGYvIduzrCF<*12hQ6FlD>o7d#3T5ad^tEB>+&K z(JHW|mXMs}SUPrw@Ics7ftJc%Vz8xSJb7H{*cnlZF$QhM|Lj zV4%;ysddM4|IhKu3>NwQl;{Nm!N5ObfJfD$nqgCZw|?86+_eeq8cjsvIx!%ydyfEg hlEh$|gCLzzX!H60ia0VO0q*$ literal 0 HcmV?d00001 diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..3f6df07 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,61 @@ +{ + "object": { + "pins": [ + { + "package": "Chalk", + "repositoryURL": "https://github.com/mxcl/Chalk.git", + "state": { + "branch": null, + "revision": "a7f58e47a08ca5a84f73acc4bcf6c2c19d990609", + "version": "0.5.0" + } + }, + { + "package": "FileCheck", + "repositoryURL": "https://github.com/llvm-swift/FileCheck.git", + "state": { + "branch": null, + "revision": "f7c5f1a9479b33a876a6f5632ca2b92a7ce4b667", + "version": "0.2.6" + } + }, + { + "package": "Nimble", + "repositoryURL": "https://github.com/Quick/Nimble.git", + "state": { + "branch": null, + "revision": "7a46a5fc86cb917f69e3daf79fcb045283d8f008", + "version": "8.1.2" + } + }, + { + "package": "Quick", + "repositoryURL": "https://github.com/Quick/Quick.git", + "state": { + "branch": null, + "revision": "09b3becb37cb2163919a3842a4c5fa6ec7130792", + "version": "2.2.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser", + "state": { + "branch": null, + "revision": "41982a3656a71c768319979febd796c6fd111d5c", + "version": "1.5.0" + } + }, + { + "package": "SwiftCheck", + "repositoryURL": "https://github.com/typelift/SwiftCheck.git", + "state": { + "branch": null, + "revision": "077c096c3ddfc38db223ac8e525ad16ffb987138", + "version": "0.12.0" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift index f101fea..ec97113 100644 --- a/Package.swift +++ b/Package.swift @@ -11,10 +11,18 @@ let package = Package( products: [ .library( name: "TrueTime", - targets: ["TrueTime"] - ) + targets: ["TrueTime"]), + .library( + name: "CTrueTime", + targets: ["CTrueTime"]) + + ], + dependencies: [ + .package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.1")), + .package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "2.1.0")), + .package(url: "https://github.com/typelift/SwiftCheck.git", .upToNextMajor(from: "0.12.0")), ], - dependencies: [], + targets: [ // Objective-C 모듈 타겟 .target( @@ -28,8 +36,8 @@ let package = Package( // Swift 모듈 타겟 .target( name: "TrueTime", - dependencies: ["CTrueTime"], - path: "Sources/Swift" - ) + dependencies: ["CTrueTime"]), + .systemLibrary(name: "CTrueTime") + ] ) From 9284e54ffa5de04da5b8a7953948a2cc763c422f Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Wed, 18 Dec 2024 18:46:56 +0900 Subject: [PATCH 27/30] =?UTF-8?q?Package.swift=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Package.resolved | 61 --------------------- Package.swift | 35 ++++-------- Sources/{ => CTrueTime}/TrueTime.h | 0 Sources/{ => CTrueTime}/TrueTime.m | 0 Sources/CTrueTime/include/module.modulemap | 5 -- Sources/CTrueTime/module.modulemap | 2 +- Sources/CTrueTime/{include => }/ntp_types.h | 0 Sources/Swift/Endian.swift | 1 + Sources/Swift/NTPClient.swift | 3 + Sources/Swift/NTPConnection.swift | 1 + Sources/Swift/NTPExtensions.swift | 5 +- Sources/Swift/NTPResponse.swift | 1 + Sources/Swift/ReferenceTime.swift | 3 + Sources/Swift/TimedOperation.swift | 2 +- Sources/Swift/TrueTime.swift | 4 +- 15 files changed, 28 insertions(+), 95 deletions(-) delete mode 100644 Package.resolved rename Sources/{ => CTrueTime}/TrueTime.h (100%) rename Sources/{ => CTrueTime}/TrueTime.m (100%) delete mode 100644 Sources/CTrueTime/include/module.modulemap rename Sources/CTrueTime/{include => }/ntp_types.h (100%) diff --git a/Package.resolved b/Package.resolved deleted file mode 100644 index 3f6df07..0000000 --- a/Package.resolved +++ /dev/null @@ -1,61 +0,0 @@ -{ - "object": { - "pins": [ - { - "package": "Chalk", - "repositoryURL": "https://github.com/mxcl/Chalk.git", - "state": { - "branch": null, - "revision": "a7f58e47a08ca5a84f73acc4bcf6c2c19d990609", - "version": "0.5.0" - } - }, - { - "package": "FileCheck", - "repositoryURL": "https://github.com/llvm-swift/FileCheck.git", - "state": { - "branch": null, - "revision": "f7c5f1a9479b33a876a6f5632ca2b92a7ce4b667", - "version": "0.2.6" - } - }, - { - "package": "Nimble", - "repositoryURL": "https://github.com/Quick/Nimble.git", - "state": { - "branch": null, - "revision": "7a46a5fc86cb917f69e3daf79fcb045283d8f008", - "version": "8.1.2" - } - }, - { - "package": "Quick", - "repositoryURL": "https://github.com/Quick/Quick.git", - "state": { - "branch": null, - "revision": "09b3becb37cb2163919a3842a4c5fa6ec7130792", - "version": "2.2.1" - } - }, - { - "package": "swift-argument-parser", - "repositoryURL": "https://github.com/apple/swift-argument-parser", - "state": { - "branch": null, - "revision": "41982a3656a71c768319979febd796c6fd111d5c", - "version": "1.5.0" - } - }, - { - "package": "SwiftCheck", - "repositoryURL": "https://github.com/typelift/SwiftCheck.git", - "state": { - "branch": null, - "revision": "077c096c3ddfc38db223ac8e525ad16ffb987138", - "version": "0.12.0" - } - } - ] - }, - "version": 1 -} diff --git a/Package.swift b/Package.swift index ec97113..5138b33 100644 --- a/Package.swift +++ b/Package.swift @@ -1,12 +1,10 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.6 import PackageDescription let package = Package( name: "TrueTime", platforms: [ - .iOS(.v10), // iOS 10.0 이상 지원 - .macOS(.v10_15), // macOS 10.15 이상 지원 - .tvOS(.v10) // tvOS 10.0 이상 지원 + .iOS(.v15), // iOS 10.0 이상 지원 ], products: [ .library( @@ -14,30 +12,21 @@ let package = Package( targets: ["TrueTime"]), .library( name: "CTrueTime", - targets: ["CTrueTime"]) + targets: ["CTrueTime"] + ) ], - dependencies: [ - .package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.1")), - .package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "2.1.0")), - .package(url: "https://github.com/typelift/SwiftCheck.git", .upToNextMajor(from: "0.12.0")), - ], + dependencies: [], targets: [ - // Objective-C 모듈 타겟 - .target( - name: "CTrueTime", - path: "Sources/CTrueTime", - publicHeadersPath: "include", - cSettings: [ - .headerSearchPath("include"), - ] - ), - // Swift 모듈 타겟 .target( name: "TrueTime", - dependencies: ["CTrueTime"]), - .systemLibrary(name: "CTrueTime") - + dependencies: ["CTrueTime"], + path: "Sources/Swift" + ), + .systemLibrary( + name: "CTrueTime", + path: "Sources/CTrueTime" + ) ] ) diff --git a/Sources/TrueTime.h b/Sources/CTrueTime/TrueTime.h similarity index 100% rename from Sources/TrueTime.h rename to Sources/CTrueTime/TrueTime.h diff --git a/Sources/TrueTime.m b/Sources/CTrueTime/TrueTime.m similarity index 100% rename from Sources/TrueTime.m rename to Sources/CTrueTime/TrueTime.m diff --git a/Sources/CTrueTime/include/module.modulemap b/Sources/CTrueTime/include/module.modulemap deleted file mode 100644 index 32ece5d..0000000 --- a/Sources/CTrueTime/include/module.modulemap +++ /dev/null @@ -1,5 +0,0 @@ -module CTrueTime { - umbrella header "ntp_types.h" - export * - module * { export * } -} diff --git a/Sources/CTrueTime/module.modulemap b/Sources/CTrueTime/module.modulemap index 75108b7..b022ad4 100644 --- a/Sources/CTrueTime/module.modulemap +++ b/Sources/CTrueTime/module.modulemap @@ -1,4 +1,4 @@ module CTrueTime [system] { - header "ntp_types.h" + header "TrueTime.h" export * } diff --git a/Sources/CTrueTime/include/ntp_types.h b/Sources/CTrueTime/ntp_types.h similarity index 100% rename from Sources/CTrueTime/include/ntp_types.h rename to Sources/CTrueTime/ntp_types.h diff --git a/Sources/Swift/Endian.swift b/Sources/Swift/Endian.swift index 348fa59..c65c8e4 100644 --- a/Sources/Swift/Endian.swift +++ b/Sources/Swift/Endian.swift @@ -7,6 +7,7 @@ // import Foundation +import CTrueTime protocol NetworkOrderConvertible { var byteSwapped: Self { get } diff --git a/Sources/Swift/NTPClient.swift b/Sources/Swift/NTPClient.swift index e340749..77fa64e 100644 --- a/Sources/Swift/NTPClient.swift +++ b/Sources/Swift/NTPClient.swift @@ -6,6 +6,9 @@ // Copyright © 2016 Instacart. All rights reserved. // +import Foundation +import CTrueTime + struct NTPConfig { let timeout: TimeInterval let maxRetries: Int diff --git a/Sources/Swift/NTPConnection.swift b/Sources/Swift/NTPConnection.swift index 2606da3..7d02df0 100644 --- a/Sources/Swift/NTPConnection.swift +++ b/Sources/Swift/NTPConnection.swift @@ -7,6 +7,7 @@ // import Foundation +import CTrueTime typealias NTPConnectionCallback = (NTPConnection, FrozenNetworkTimeResult) -> Void diff --git a/Sources/Swift/NTPExtensions.swift b/Sources/Swift/NTPExtensions.swift index c7d5088..e9a36dd 100644 --- a/Sources/Swift/NTPExtensions.swift +++ b/Sources/Swift/NTPExtensions.swift @@ -7,6 +7,7 @@ // import Foundation +import CTrueTime public extension timeval { static func uptime() -> timeval { @@ -94,7 +95,7 @@ extension ByteRepresentable { extension ntp_packet_t: ByteRepresentable {} extension sockaddr_in: ByteRepresentable {} extension sockaddr_in6: ByteRepresentable {} -extension sockaddr_in6: CustomStringConvertible { +extension sockaddr_in6: @retroactive CustomStringConvertible { public var description: String { var buffer = [Int8](repeating: 0, count: Int(INET6_ADDRSTRLEN)) var addr = sin6_addr @@ -106,7 +107,7 @@ extension sockaddr_in6: CustomStringConvertible { } } -extension sockaddr_in: CustomStringConvertible { +extension sockaddr_in: @retroactive CustomStringConvertible { public var description: String { let host = String(cString: inet_ntoa(sin_addr)) let port = Int(sin_port) diff --git a/Sources/Swift/NTPResponse.swift b/Sources/Swift/NTPResponse.swift index b9bc6d9..c3b2f72 100644 --- a/Sources/Swift/NTPResponse.swift +++ b/Sources/Swift/NTPResponse.swift @@ -7,6 +7,7 @@ // import Foundation +import CTrueTime struct NTPResponse { let packet: ntp_packet_t diff --git a/Sources/Swift/ReferenceTime.swift b/Sources/Swift/ReferenceTime.swift index f187b25..bcd95bd 100644 --- a/Sources/Swift/ReferenceTime.swift +++ b/Sources/Swift/ReferenceTime.swift @@ -6,6 +6,9 @@ // Copyright © 2016 Instacart. All rights reserved. // +import Foundation +import CTrueTime + typealias FrozenTimeResult = Result typealias FrozenTimeCallback = (FrozenTimeResult) -> Void diff --git a/Sources/Swift/TimedOperation.swift b/Sources/Swift/TimedOperation.swift index 3ebcdf8..48d0f5a 100644 --- a/Sources/Swift/TimedOperation.swift +++ b/Sources/Swift/TimedOperation.swift @@ -8,7 +8,7 @@ import Foundation -protocol TimedOperation: class { +protocol TimedOperation: AnyObject { var started: Bool { get } var timeout: TimeInterval { get } var timer: DispatchSourceTimer? { get set } diff --git a/Sources/Swift/TrueTime.swift b/Sources/Swift/TrueTime.swift index a588a4e..a68255b 100644 --- a/Sources/Swift/TrueTime.swift +++ b/Sources/Swift/TrueTime.swift @@ -117,9 +117,9 @@ extension TrueTimeClient { @objc public func fetchIfNeeded(success: @escaping (ReferenceTime) -> Void, failure: ((NSError) -> Void)?, onQueue queue: DispatchQueue) { - fetchIfNeeded(queue: queue) { result in + fetchIfNeeded(queue: queue, completion: { result in self.mapBridgedResult(result, success: success, failure: failure) - } + }) } private func mapBridgedResult(_ result: ReferenceTimeResult, From 7e4958b8e059e5fd2ab81dfaf29afcb62f7d8d62 Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Wed, 18 Dec 2024 18:52:11 +0900 Subject: [PATCH 28/30] =?UTF-8?q?TrueTime.h=20=EC=97=90=20=EC=9E=88?= =?UTF-8?q?=EB=8D=98=20=EC=BD=94=EB=93=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Swift/TrueTime.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/Swift/TrueTime.swift b/Sources/Swift/TrueTime.swift index a68255b..4a34490 100644 --- a/Sources/Swift/TrueTime.swift +++ b/Sources/Swift/TrueTime.swift @@ -8,6 +8,13 @@ import Foundation +let TrueTimeErrorDomain = "com.instacart.TrueTimeErrorDomain" + +extension Notification.Name { + static let TrueTimeUpdated = Notification.Name.init("TrueTimeUpdatedNotification") +} + + @objc public enum TrueTimeError: Int { case cannotFindHost case dnsLookupFailed From 3172b735b1f41379c10bb2ae764d8a0afb8866dd Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Wed, 18 Dec 2024 18:53:11 +0900 Subject: [PATCH 29/30] =?UTF-8?q?=EB=AF=B8=EC=82=AC=EC=9A=A9=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/CTrueTime/TrueTime.h | 26 -------------------------- Sources/CTrueTime/TrueTime.m | 12 ------------ 2 files changed, 38 deletions(-) delete mode 100644 Sources/CTrueTime/TrueTime.h delete mode 100644 Sources/CTrueTime/TrueTime.m diff --git a/Sources/CTrueTime/TrueTime.h b/Sources/CTrueTime/TrueTime.h deleted file mode 100644 index a9b09ab..0000000 --- a/Sources/CTrueTime/TrueTime.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// TrueTime.h -// TrueTime -// -// Created by Michael Sanders on 7/9/16. -// Copyright © 2016 Instacart. All rights reserved. -// - -@import Foundation; -#import "ntp_types.h" - -NS_ASSUME_NONNULL_BEGIN - -//! Project version number for TrueTime. -FOUNDATION_EXPORT double TrueTimeVersionNumber; - -//! Project version string for TrueTime. -FOUNDATION_EXPORT const unsigned char TrueTimeVersionNumberString[]; - -//! Domain for TrueTime errors. -FOUNDATION_EXPORT NSString * const TrueTimeErrorDomain; - -//! Notification sent whenever a TrueTimeClient's reference time is updated. -FOUNDATION_EXPORT NSString * const TrueTimeUpdatedNotification; - -NS_ASSUME_NONNULL_END diff --git a/Sources/CTrueTime/TrueTime.m b/Sources/CTrueTime/TrueTime.m deleted file mode 100644 index a8f2647..0000000 --- a/Sources/CTrueTime/TrueTime.m +++ /dev/null @@ -1,12 +0,0 @@ -// -// TrueTime.m -// TrueTime -// -// Created by Michael Sanders on 8/15/16. -// Copyright © 2016 Instacart. All rights reserved. -// - -#import "TrueTime.h" - -NSString * const TrueTimeErrorDomain = @"com.instacart.TrueTimeErrorDomain"; -NSString * const TrueTimeUpdatedNotification = @"TrueTimeUpdatedNotification"; From 70f2f498675817a13c2526932cb4736c45d98bd7 Mon Sep 17 00:00:00 2001 From: jalynneyoon Date: Wed, 18 Dec 2024 19:01:53 +0900 Subject: [PATCH 30/30] =?UTF-8?q?=EB=AF=B8=EC=82=AC=EC=9A=A9=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/CTrueTime/module.modulemap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/CTrueTime/module.modulemap b/Sources/CTrueTime/module.modulemap index b022ad4..75108b7 100644 --- a/Sources/CTrueTime/module.modulemap +++ b/Sources/CTrueTime/module.modulemap @@ -1,4 +1,4 @@ module CTrueTime [system] { - header "TrueTime.h" + header "ntp_types.h" export * }