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"
"io/ioutil"
"os"
"time"
)
type IridiumSDB struct {
@ -22,7 +23,11 @@ type MOHeader struct {
Status byte
MOMSN 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 {
@ -193,8 +198,8 @@ func parseSDB(raw []byte) error {
v.MOMSN)
fmt.Printf("\tMO Header MTMSN: %d\n",
v.MTMSN)
fmt.Printf("\tMO Header Session Time: %d\n",
v.SessionTime)
fmt.Printf("\tMO Header Session Time: %s\n",
v.SessionTime().String())
case MOPayload:
fmt.Printf("\tMO Payload IEI: %d\n",