From 140ad92a3bbab485ef0f27c7be03d62d10ffd067 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 27 Jan 2020 23:09:48 -0500 Subject: fix --- rrdformat/format.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'rrdformat/format.go') diff --git a/rrdformat/format.go b/rrdformat/format.go index 2900ce8..91e5669 100644 --- a/rrdformat/format.go +++ b/rrdformat/format.go @@ -1,6 +1,8 @@ package rrdformat import ( + "time" + "git.lukeshu.com/go/librrd/rrdformat/rrdbinary" ) @@ -58,9 +60,10 @@ type DSDef struct { } type RRADef struct { - CFName rrdbinary.String `rrdbinary:"size=20"` - RowCnt rrdbinary.Uint - PDPCnt rrdbinary.Uint + CFName rrdbinary.String `rrdbinary:"size=20"` + RowCnt rrdbinary.Uint + PDPCnt rrdbinary.Uint + Paameters [10]rrdbinary.Unival } type TimeWithUsec struct { @@ -68,8 +71,16 @@ type TimeWithUsec struct { Usec rrdbinary.Int // signed, but always >= 0 } +func (ts TimeWithUsec) Time() time.Time { + return time.Unix(int64(ts.Sec), int64(ts.Usec)*1000) +} + type TimeWithoutUsec struct { - Sec rrdbinary.Time + Sec rrdbinary.Time +} + +func (ts TimeWithoutUsec) Time() time.Time { + return time.Unix(int64(ts.Sec), 0) } type PDPPrep struct { -- cgit v1.2.3-54-g00ecf