forked from bougou/go-ipmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_get_sel_time.go
49 lines (39 loc) · 928 Bytes
/
cmd_get_sel_time.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ipmi
import (
"fmt"
"time"
)
// 31.10 Get SEL Time Command
type GetSELTimeRequest struct {
}
type GetSELTimeResponse struct {
// Present Timestamp clock reading
Time time.Time
}
func (req *GetSELTimeRequest) Pack() []byte {
return []byte{}
}
func (req *GetSELTimeRequest) Command() Command {
return CommandGetSELTime
}
func (res *GetSELTimeResponse) Unpack(msg []byte) error {
if len(msg) < 4 {
return ErrUnpackedDataTooShort
}
t, _, _ := unpackUint32L(msg, 0)
res.Time = parseTimestamp(t)
return nil
}
func (res *GetSELTimeResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{}
}
func (res *GetSELTimeResponse) Format() string {
return fmt.Sprintf("%v", res)
}
func (c *Client) GetSELTime() (response *GetSELTimeResponse, err error) {
request := &GetSELTimeRequest{}
response = &GetSELTimeResponse{}
err = c.Exchange(request, response)
return
}