summaryrefslogtreecommitdiff
path: root/rrdformat/format.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2020-01-27 23:09:48 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2020-01-27 23:09:48 -0500
commit140ad92a3bbab485ef0f27c7be03d62d10ffd067 (patch)
treef3954785f43680acd90f0e741be44448dfa24ad2 /rrdformat/format.go
parenta047b135ca416584178a6adde64cc156ab637431 (diff)
fix
Diffstat (limited to 'rrdformat/format.go')
-rw-r--r--rrdformat/format.go19
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 {