Commit 55b50754 authored by Geoff Simmons's avatar Geoff Simmons

VSM.AttachTmo() uses time.Truncate().

parent 0de7803a
......@@ -95,16 +95,16 @@ func (v *VSM) Error() string {
}
// AttachTmo sets the timeout for attaching to a Varnish instance. If
// the Duration, rounded to seconds toward 0s, is >= 0s, then wait
// that many seconds to attach. If the Duration < 0s, wait
// indefinitely. By default, the Varnish default timeout holds (5s in
// recent Varnish versions).
// the Duration, truncated to seconds, is >= 0s, then wait that many
// seconds to attach. If the Duration < 0s, wait indefinitely. By
// default, the Varnish default timeout holds (5s in recent Varnish
// versions).
func (v *VSM) AttachTmo(tmo time.Duration) error {
if err := v.checkNil(); err != nil {
return err
}
arg := "off"
secs := tmo / time.Second
secs := tmo.Truncate(time.Second)
if secs >= 0 {
arg = strconv.FormatUint(uint64(secs), 10)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment