Skip to content

Commit 70c0af1

Browse files
committed
Simplify deadlineDate
1 parent bf738fe commit 70c0af1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/AWSLambdaRuntime/FoundationSupport/Context+Foundation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ import struct Foundation.Date
2020
#endif
2121

2222
extension LambdaContext {
23+
/// Returns the deadline as a Date for the Lambda function execution.
24+
/// I'm not sure how usefull it is to have this as a Date, with only seconds precision,
25+
/// but I leave it here for compatibility with the FoundationJSONSupport trait.
2326
var deadlineDate: Date {
24-
let secondsSinceEpoch = Double(self.deadline.milliseconds()) / -1_000_000_000
25-
return Date(timeIntervalSince1970: secondsSinceEpoch)
27+
Date(timeIntervalSince1970: Double(self.deadline.milliseconds()) / 1000)
2628
}
2729
}
2830
#endif // trait: FoundationJSONSupport

0 commit comments

Comments
 (0)