forked from HVelosoETI/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zda.go
33 lines (30 loc) · 789 Bytes
/
zda.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
package nmea
const (
// TypeZDA type for ZDA sentences
TypeZDA = "ZDA"
)
// ZDA represents date & time data.
// http://aprs.gids.nl/nmea/#zda
type ZDA 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
}
// newZDA constructor
func newZDA(s BaseSentence) (ZDA, error) {
p := newParser(s)
p.AssertType(TypeZDA)
return ZDA{
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()
}