Improved session time handling

This commit is contained in:
Christopher Ramey 2019-10-01 08:11:54 -08:00 committed by Christopher Ramey
parent 9030148906
commit 86d509ca74

11
sdb.go
View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"time"
) )
type IridiumSDB struct { type IridiumSDB struct {
@ -22,7 +23,11 @@ type MOHeader struct {
Status byte Status byte
MOMSN uint16 MOMSN uint16
MTMSN uint16 MTMSN uint16
SessionTime uint32 TimeSession uint32
}
func (h MOHeader) SessionTime() time.Time {
return time.Unix(int64(h.TimeSession), 0)
} }
func (h MOHeader) StatusString() string { func (h MOHeader) StatusString() string {
@ -193,8 +198,8 @@ func parseSDB(raw []byte) error {
v.MOMSN) v.MOMSN)
fmt.Printf("\tMO Header MTMSN: %d\n", fmt.Printf("\tMO Header MTMSN: %d\n",
v.MTMSN) v.MTMSN)
fmt.Printf("\tMO Header Session Time: %d\n", fmt.Printf("\tMO Header Session Time: %s\n",
v.SessionTime) v.SessionTime().String())
case MOPayload: case MOPayload:
fmt.Printf("\tMO Payload IEI: %d\n", fmt.Printf("\tMO Payload IEI: %d\n",