Skip to content
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

time.now #404

Merged
merged 2 commits into from
Dec 17, 2023
Merged

time.now #404

merged 2 commits into from
Dec 17, 2023

Conversation

jabbate19
Copy link
Collaborator

What type of PR is this?

/kind documentation
/kind feature
/kind eldritch-function

What this PR does / why we need it:

Adds time.now() to return local system time

Which issue(s) this PR fixes:

Fixes #76

Copy link

codecov bot commented Dec 17, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (dc64fc2) 71.75% compared to head (3ecd3f4) 71.77%.

Files Patch % Lines
implants/lib/eldritch/src/time.rs 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
+ Coverage   71.75%   71.77%   +0.02%     
==========================================
  Files         107      108       +1     
  Lines        7910     7923      +13     
==========================================
+ Hits         5676     5687      +11     
- Misses       2125     2127       +2     
  Partials      109      109              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

use anyhow::Result;

pub fn now() -> Result<u64> {
Ok(SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell yeah UNIX EPOCH 😎

Is there a reason (for windows folks) to do Windows EPOCH on windows hosts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, tbh I need to make a timestamp to epoch eldritch function and vice versa to make this easier for ppl.

Copy link
Collaborator

@hulto hulto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - One question about windows epoch but i'm pretty happy with just UNIX epoch.

@jabbate19 jabbate19 merged commit 0238234 into main Dec 17, 2023
8 checks passed
@jabbate19 jabbate19 deleted the time_now branch December 17, 2023 18:32
KCarretto pushed a commit that referenced this pull request Feb 1, 2024
 
time.now (#404)

* time.now

* Add library test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement time.now
2 participants