diff options
Diffstat (limited to 'rrdformat/rrdbinary/types.go')
-rw-r--r-- | rrdformat/rrdbinary/types.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/rrdformat/rrdbinary/types.go b/rrdformat/rrdbinary/types.go index cbe3e2d..892bb25 100644 --- a/rrdformat/rrdbinary/types.go +++ b/rrdformat/rrdbinary/types.go @@ -8,20 +8,24 @@ import ( type Architecture struct { ByteOrder binary.ByteOrder // C `double` - FloatWidth int // always 8 + FloatWidth int // always 8 -- we assume IEEE 754 doubles FloatAlign int - // C `unsigned long` - UintWidth int - UintAlign int + // C `long` or `unsigned long` + IntWidth int + IntAlign int // C `union { unsigned long; double; }` UnivalWidth int // max(FloatWidth, IntWidth) UnivalAlign int // max(FloatAlign, IntAlign) + // C `time_t` + TimeWidth int + TimeAlign int } -type String string // \0-terminatd -type Float float64 // 8 bytes -type Uint uint64 // 4 or 8 bytes -type Unival uint64 // 8 bytes +type String string // \0-terminatd +type Float float64 // 8 bytes +type Uint uint64 // 4 or 8 bytes +type Unival uint64 // 8 bytes +type Timestamp time.time // 8, 12, or 16 bytes func (u Unival) AsUint64() uint64 { return uint64(u) } func (u Unival) AsFloat64() float64 { return math.Float64frombits(uint64(u)) } |