aboutsummaryrefslogtreecommitdiffstats
path: root/internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go')
-rw-r--r--internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go43
1 files changed, 41 insertions, 2 deletions
diff --git a/internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go b/internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go
index 280005e..140995d 100644
--- a/internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go
+++ b/internal/testbinapi/binapi2001/vpe_types/vpe_types.ba.go
@@ -1,6 +1,6 @@
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
-// binapi-generator: v0.4.0-dev
+// binapi-generator: v0.5.0-dev
// VPP: 20.01
// source: .vppapi/core/vpe_types.api.json
@@ -14,8 +14,10 @@
package vpe_types
import (
- api "git.fd.io/govpp.git/api"
"strconv"
+ "time"
+
+ api "git.fd.io/govpp.git/api"
)
// This is a compile-time assertion to ensure that this generated file
@@ -24,6 +26,12 @@ import (
// GoVPP api package needs to be updated.
const _ = api.GoVppAPIPackageIsVersion2
+const (
+ APIFile = "vpe_types"
+ APIVersion = ""
+ VersionCrc = 0x3369988d
+)
+
// LogLevel defines enum 'log_level'.
type LogLevel uint32
@@ -78,6 +86,37 @@ type Timedelta float64
// Timestamp defines alias 'timestamp'.
type Timestamp float64
+func NewTimestamp(t time.Time) Timestamp {
+ sec := int64(t.Unix())
+ nsec := int32(t.Nanosecond())
+ ns := float64(sec) + float64(nsec/1e9)
+ return Timestamp(ns)
+}
+
+func (x Timestamp) ToTime() time.Time {
+ ns := int64(x * 1e9)
+ sec := ns / 1e9
+ nsec := ns % 1e9
+ return time.Unix(sec, nsec)
+}
+
+func (x Timestamp) String() string {
+ return x.ToTime().String()
+}
+
+func (x *Timestamp) MarshalText() ([]byte, error) {
+ return []byte(x.ToTime().Format(time.RFC3339Nano)), nil
+}
+
+func (x *Timestamp) UnmarshalText(text []byte) error {
+ t, err := time.Parse(time.RFC3339Nano, string(text))
+ if err != nil {
+ return err
+ }
+ *x = NewTimestamp(t)
+ return nil
+}
+
// Version defines type 'version'.
type Version struct {
Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`