diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2020-01-27 23:09:48 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2020-01-27 23:09:48 -0500 |
commit | 140ad92a3bbab485ef0f27c7be03d62d10ffd067 (patch) | |
tree | f3954785f43680acd90f0e741be44448dfa24ad2 /rrdformat/format.go | |
parent | a047b135ca416584178a6adde64cc156ab637431 (diff) |
fix
Diffstat (limited to 'rrdformat/format.go')
-rw-r--r-- | rrdformat/format.go | 19 |
1 files changed, 15 insertions, 4 deletions
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 { |