Skip to content

Commit 000c6a4

Browse files
committed
Remove some unused/untested dead code
1 parent a5b5160 commit 000c6a4

File tree

1 file changed

+0
-77
lines changed

1 file changed

+0
-77
lines changed

Sources/Tracing/TracingTime.swift

-77
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public protocol SwiftDistributedTracingInstantProtocol: Comparable, Hashable, Se
4040

4141
public protocol TracerInstantProtocol: SwiftDistributedTracingInstantProtocol {
4242
/// Representation of this instant as the number of milliseconds since UNIX Epoch (January 1st 1970)
43-
@inlinable
4443
var millisecondsSinceEpoch: UInt64 { get }
4544
}
4645

@@ -64,7 +63,6 @@ public protocol TracerClock {
6463
/// A basic "timestamp clock" implementation that is able to five the current time as an unix timestamp.
6564
public struct DefaultTracerClock: TracerClock {
6665
public typealias Instant = Timestamp
67-
internal typealias TimeInterval = Double
6866

6967
public init() {
7068
// empty
@@ -107,78 +105,3 @@ public struct DefaultTracerClock: TracerClock {
107105
return Instant(millisecondsSinceEpoch: nowMillis)
108106
}
109107
}
110-
111-
#if swift(>=5.7.0)
112-
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
113-
extension Duration {
114-
typealias Value = Int64
115-
116-
var nanoseconds: Value {
117-
let (seconds, attoseconds) = self.components
118-
let sNanos = seconds * Value(1_000_000_000)
119-
let asNanos = attoseconds / Value(1_000_000_000)
120-
let (totalNanos, overflow) = sNanos.addingReportingOverflow(asNanos)
121-
return overflow ? .max : totalNanos
122-
}
123-
124-
/// The microseconds representation of the `TimeAmount`.
125-
var microseconds: Value {
126-
self.nanoseconds / TimeUnit.microseconds.rawValue
127-
}
128-
129-
/// The milliseconds representation of the `TimeAmount`.
130-
var milliseconds: Value {
131-
self.nanoseconds / TimeUnit.milliseconds.rawValue
132-
}
133-
134-
/// The seconds representation of the `TimeAmount`.
135-
var seconds: Value {
136-
self.nanoseconds / TimeUnit.seconds.rawValue
137-
}
138-
139-
var isEffectivelyInfinite: Bool {
140-
self.nanoseconds == .max
141-
}
142-
}
143-
144-
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
145-
extension Duration {
146-
private func chooseUnit(_ ns: Value) -> TimeUnit {
147-
if ns / TimeUnit.seconds.rawValue > 0 {
148-
return TimeUnit.seconds
149-
} else if ns / TimeUnit.milliseconds.rawValue > 0 {
150-
return TimeUnit.milliseconds
151-
} else if ns / TimeUnit.microseconds.rawValue > 0 {
152-
return TimeUnit.microseconds
153-
} else {
154-
return TimeUnit.nanoseconds
155-
}
156-
}
157-
158-
/// Represents number of nanoseconds within given time unit
159-
enum TimeUnit: Value {
160-
case seconds = 1_000_000_000
161-
case milliseconds = 1_000_000
162-
case microseconds = 1000
163-
case nanoseconds = 1
164-
165-
var abbreviated: String {
166-
switch self {
167-
case .nanoseconds: return "ns"
168-
case .microseconds: return "μs"
169-
case .milliseconds: return "ms"
170-
case .seconds: return "s"
171-
}
172-
}
173-
174-
func duration(_ duration: Int) -> Duration {
175-
switch self {
176-
case .nanoseconds: return .nanoseconds(Value(duration))
177-
case .microseconds: return .microseconds(Value(duration))
178-
case .milliseconds: return .milliseconds(Value(duration))
179-
case .seconds: return .seconds(Value(duration))
180-
}
181-
}
182-
}
183-
}
184-
#endif

0 commit comments

Comments
 (0)