Skip to content

Commit 7d62713

Browse files
committed
inline constant for NSEC_PER_SEC
1 parent 2c8c552 commit 7d62713

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/CBOREncoder.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ extension CBOR {
265265
let (integral, fractional) = modf(timeInterval)
266266

267267
let seconds = Int64(integral)
268-
let nanoseconds = Int32(fractional * Double(NSEC_PER_SEC))
268+
// The NSEC_PER_SEC value is 1,000,000,000 (one billion), representing the number of nanoseconds in one second.
269+
let nanoseconds = Int32(fractional * Double(1_000_000_000))
269270

270271
switch options.dateStrategy {
271272
case .annotatedMap:

0 commit comments

Comments
 (0)