Skip to content

Add the convenience fun Time_ns.since#171

Closed
theteachr wants to merge 1 commit intojanestreet:masterfrom
theteachr:time-ns.since
Closed

Add the convenience fun Time_ns.since#171
theteachr wants to merge 1 commit intojanestreet:masterfrom
theteachr:time-ns.since

Conversation

@theteachr
Copy link
Copy Markdown

@theteachr theteachr commented May 23, 2024

Adds a convenience function to compute the elapsed time. Instead of

Time_ns.(diff (now ()) start)

One can do

Time_ns.since start

@theteachr theteachr force-pushed the time-ns.since branch 2 times, most recently from aa9b919 to 9091d62 Compare May 23, 2024 13:32
Signed-off-by: theteachr <sop.theteachr@gmail.com>
@nmatschke
Copy link
Copy Markdown
Member

Thanks for the PR. We discussed internally and decided we'd prefer not to merge it - sorry!

In particular, we're concerned that this hides the dependency on now, and makes it harder to reason about code. Also, if you call since twice, you will use two different values of now! While having to spell out now is a bit verbose, it makes the dependency on the system clock more explicit, and makes it easier to spot bugs.

@nmatschke nmatschke closed this Apr 16, 2026
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.

2 participants