-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add SystemTime
#9
Conversation
Although there's an open pull request to the `instant` crate to support SystemTime and UNIX_EPOCH (sebcrozet/instant#9), it is simpler to change ui/logo to simply use Instant and Duration.
@sebcrozet I'd be interested in this PR. Would you be open to merging it if I warm it up? |
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.
@wngr Hey! Thank you for the reminder. Yeah, that sounds like a useful PR.
pub struct SystemTime(f64); | ||
|
||
impl SystemTime { | ||
pub const UNIX_EPOCH: SystemTime = SystemTime(0.0); |
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 don’t think this is a valid definition. It is my understanding that doing SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)
should return the duration since the unix epoch. However, the now
function may return results from the JS function performance.now()
, which is not relative to the UNIX epoch.
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.
What about wngr@bd46ccb ? If @expenses agrees, I could create a new PR based on her commits.
Closing this because #42 was merged instead. |
Hi, It would be super useful to have a
SystemTime
implementation, mostly forUNIX_EPOCH
.