[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #33038 [Circumvention/Snowflake]: Represent timeouts using time.Duration
#33038: Represent timeouts using time.Duration
-----------------------------------------+----------------------
Reporter: dcf | Owner: dcf
Type: enhancement | Status: assigned
Priority: Medium | Milestone:
Component: Circumvention/Snowflake | Version:
Severity: Minor | Keywords:
Actual Points: | Parent ID:
Points: | Reviewer:
Sponsor: |
-----------------------------------------+----------------------
Representing these constants in `time.Duration` form is more semantic, and
allows rewriting
{{{
if time.Since(start).Seconds() > myTimeout {
}}}
as
{{{
if time.Since(start) > myTimeout {
}}}
One side effect is that `Printf` formatting
[https://golang.org/pkg/time/#Duration.String renders] a `time.Duration`
as a string like `10s` or `100ms`, which changes some log messages
slightly. If we need compatibility of log message formats, we could use
`.Seconds()` in those places.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33038>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs