ziutek / rrd

Bindings to rrdtool
Other
147 stars 44 forks source link

Error with VRule #19

Closed mlgd closed 9 years ago

mlgd commented 9 years ago

If the argument t is "time.Time", a crash occured with a message like this : parameter '%!s(int64=1421794800)' does not represent time in line VRULE:%!s(int64=1421794800)#ff0000

You shouldn't use "%s" parameter in Sprintf because v.Unix() return int64, not a string

func (g *Grapher) VRule(t interface{}, color string, options ...string) { if v, ok := t.(time.Time); ok { t = v.Unix() } vr := fmt.Sprintf("VRULE:%s#%s", t, color) g.push(vr, options) }

ziutek commented 9 years ago

Fixed. Thanks!