Specifications

58
#there's about 10^-18 chances of an error after 10^10 messages received...
FormatBytesNum = {}
FormatBytesNum['f'] = 2# value encoded as 2 bytes base-10 floating point (GFP2)
FormatBytesNum['l'] = 4# value encoded as 4 bytes two's complement integer (GLI4)
FormatBytesNum['t'] = 4# timestamp as seconds since 1990-01-01 00:00:00 +0000
encoded as GLI4
FormatBytesNum['g'] = 4# GPS time encoded as GLI4
FormatBytesNum['n'] = 4# GPS latitude encoded as GLI4
FormatBytesNum['e'] = 4# GPS latitude encoded as GLI4
FormatSpec = {}
#GlacioBasis 2009 Top
FormatSpec[10] = [49, "tfffffffffffffffffffffffffffffffffffgneffffffffff", "GlacioBasis 2009
Top 1-h summer message"]
FormatSpec[11] = [56, "tfffffffffffffffffffffffffffffffffffgnefffffffffffffffff", "GlacioBasis
2009 Top 1-h summer message (+ instant.)"]
FormatSpec[12] = [49, "tfffffffffffffffffffffffffffffffffffgneffffffffff", "GlacioBasis 2009
Top 3-h winter message"]
FormatSpec[13] = [56, "tfffffffffffffffffffffffffffffffffffgnefffffffffffffffff", "GlacioBasis
2009 Top 3-h winter message (+ instant.)"]
FormatSpec[14] = [22, "tfffffffffffffffffffff", "GlacioBasis 2009 Top diagnostic
message"]
#GlacioBasis 2009 Main
FormatSpec[20] = [41, "tfffffffffffffffffffffffffffgneffffffffff", "GlacioBasis 2009 Main 1-
h summer message"]
FormatSpec[21] = [50, "tfffffffffffffffffffffffffffgnefffffffffffffffffff", "GlacioBasis 2009
Main 1-h summer message (+ instant.)"]
FormatSpec[22] = [41, "tfffffffffffffffffffffffffffgneffffffffff", "GlacioBasis 2009 Main 3-
h winter message"]
FormatSpec[23] = [50, "tfffffffffffffffffffffffffffgnefffffffffffffffffff", "GlacioBasis 2009
Main 3-h winter message (+ instant.)"]
FormatSpec[24] = [22, "tfffffffffffffffffffff", "GlacioBasis 2009 Main diagnostic
message"]
# Win32 epoch is 1st Jan 1601 but MSC epoch is 1st Jan 1970 (MSDN gmtime docs),
same as Unix epoch.
# Neither Python nor ANSI-C explicitly specify any epoch but CPython relies on the
underlying C
# library. CRbasic instead has the SecsSince1990() function.
UnixEpochOffset = calendar.timegm((1970, 1, 1, 0, 0, 0, 0, 1, 0)) #this should always be
0 in CPython on Win32
CRbasicEpochOffset = calendar.timegm((1990, 1, 1, 0, 0, 0, 0, 1, 0))
EpochOffset = UnixEpochOffset + CRbasicEpochOffset