Repository navigation
apollo_network_benchmark: add seconds_since_epoch helper function - #11559
Conversation
|
There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. |
| pub fn seconds_since_epoch() -> u64 { | ||
| let now = SystemTime::now(); | ||
| now.duration_since(UNIX_EPOCH).unwrap().as_secs() | ||
| } |
There was a problem hiding this comment.
New exported function seconds_since_epoch is unused
Low Severity
The newly added pub fn seconds_since_epoch() has no callers anywhere in the codebase. A grep for seconds_since_epoch returns only the definition itself. If this is intended for a downstream PR in the stack, it may be better to introduce it together with its usage to avoid dead code in the interim.
6e7d057 to
ffaea93
Compare
ffaea93 to
c686f08
Compare
64dcc25 to
8cd5e64
Compare
8cd5e64 to
f8aaeb3
Compare
c686f08 to
a5e0165
Compare
a5e0165 to
1d13062
Compare
04b68d7 to
bbb74b0
Compare
1d13062 to
0edd3bd
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| pub fn seconds_since_epoch() -> u64 { | ||
| let now = SystemTime::now(); | ||
| now.duration_since(UNIX_EPOCH).unwrap().as_secs() | ||
| } |
There was a problem hiding this comment.
New helper duplicates existing Clock::unix_now() utility
Low Severity
The new seconds_since_epoch function duplicates functionality already provided by Clock::unix_now() in apollo_time::time. That trait method returns u64 seconds from epoch and is available via DefaultClock. Using the existing Clock trait would also enable mocking in tests via MockClock.
0edd3bd to
b7e9596
Compare



Note
Low Risk
Small, isolated utility addition in benchmark code; only risk is the
unwrap()on system clock time, which could panic in unusual environments.Overview
Adds a
seconds_since_epoch()helper inbroadcast_network_stress_test_node/metrics.rs(and the requiredSystemTime/UNIX_EPOCHimports) to expose the current Unix timestamp in seconds for use by the benchmark/stress-test code.Written by Cursor Bugbot for commit b7e9596. This will update automatically on new commits. Configure here.