You are replying to a message from over a year ago. You should review all that has happened since then. For example,
https://go-review.googlesource.com/#/c/22357/ https://github.com/golang/go/issues/14058 Things have changed. Peter On Tuesday, February 28, 2017 at 9:29:15 AM UTC-5, andyxning wrote: > > This should be good enough to justify what is a zero duration. > > 在 2016年1月21日星期四 UTC+8下午12:57:26,peterGo写道: >> >> Simon, >> >> By design, the Go answer to problems like this is often a simple >> function. For example, >> >> package main >> >> import ( >> "fmt" >> "time" >> ) >> >> type DurationZero struct{ time.Duration } >> >> func (d DurationZero) String() string { >> if d.Duration == 0 { >> return "0s" >> } >> return fmt.Sprint(d.Duration) >> } >> >> func main() { >> var d time.Duration >> fmt.Println(DurationZero{d}) >> d = 7 * time.Second >> fmt.Println(DurationZero{d}) >> d = 42 * time.Nanosecond >> fmt.Println(DurationZero{d}) >> } >> >> Output: >> >> 0s >> 7s >> 42ns >> >> >> https://play.golang.org/p/p9Av-oYMaE >> >> Peter >> >> On Wednesday, January 20, 2016 at 7:09:35 PM UTC-5, simon place wrote: >>> >>> see; http://play.golang.org/p/NQy0qmjEX3 >>> >>> >>> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.