-
Notifications
You must be signed in to change notification settings - Fork 690
Support for 64-bit timespec seconds on 32-bit platforms #3277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for filing this! I've left a quick note in the diff.
#else | ||
let tvSec = curTime.tv_sec + Int((allNSecs / nsecPerSec)) | ||
#endif | ||
let tvSec = curTime.tv_sec + _Seconds((allNSecs / nsecPerSec)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm inclined to assume that we could actually just make this time_t
on all platforms.
let nsecPerSec: Int64 = 1_000_000_000 | ||
let ns = amount.nanoseconds | ||
let sec = ns / nsecPerSec | ||
self = timespec(tv_sec: Int(sec), tv_nsec: Int(ns - sec * nsecPerSec)) | ||
self = timespec(tv_sec: _Seconds(sec), tv_nsec: Int(ns - sec * nsecPerSec)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, I'm inclined to assume we could just make this a time_t
on all platforms.
Modern 32-bit platforms (such as embedded Linux builds) support 64-bit timestamps in time_t and timespec.
c50e12d
to
a143444
Compare
Thanks for this! ✨ |
Great! Out of interest, what's the release cadence of swift-nio? Curious when we can enable 64-bit timestamps in the Yocto layer. |
I expect we'll be able to release this week. |
Shipped as 2.84.0. |
Modern 32-bit platforms (such as embedded Linux builds) support 64-bit timestamps in
time_t
andtimespec
. Accommodate this.