forked from adrianmo/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpzda.go
32 lines (29 loc) · 785 Bytes
/
gpzda.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
package nmea
const (
// PrefixGPZDA prefix
PrefixGPZDA = "GPZDA"
)
// GPZDA represents date & time data.
// http://aprs.gids.nl/nmea/#zda
type GPZDA struct {
BaseSentence
Time Time
Day int64
Month int64
Year int64
OffsetHours int64 // Local time zone offset from GMT, hours
OffsetMinutes int64 // Local time zone offset from GMT, minutes
}
// newGPZDA constructor
func newGPZDA(s BaseSentence) (GPZDA, error) {
p := newParser(s, PrefixGPZDA)
return GPZDA{
BaseSentence: s,
Time: p.Time(0, "time"),
Day: p.Int64(1, "day"),
Month: p.Int64(2, "month"),
Year: p.Int64(3, "year"),
OffsetHours: p.Int64(4, "offset (hours)"),
OffsetMinutes: p.Int64(5, "offset (minutes)"),
}, p.Err()
}