func (t *Timestamp) ReadFrom(octets []byte) in sms.go calculate timezone offset as follow:
diff := time.Duration(blocks[6]) * 15 * time.Minute
if blocks[6]>>3&0x01 == 1 { // bit 3 = GMT offset sgn
// was negative, so make UTC
date = date.Add(diff)
} else {
// was positive, so make UTC
date = date.Add(-diff)
}
In accordance with GSM 03.**:
The Time Zone indicates the difference, expressed in quarters of an hour, between the local time and GMT. In the first of the two semi-octets, the first bit (bit 3 of the seventh octet of the TP-Service CentreTime-Stamp ield) represents the algebraic sign of this difference (0 : positive, 1 : negative)
But semi-octets was swapped and recoded to decimal with DecodeSemi:
for example, zone +03:00 trasmitted like 0x21, but after DecodeSemi looks like 12,
or zone -03:00 trasmitted like 0x29, but after DecodeSemi looks like 92,
I.e. negative offset after DecodeSemi will greater than 80 (bit 3 in seventh octet is 0x08 )
I propose to replace the code with something like follow:
if blocks[6] >= 80 {
// was negative, so make UTC
diff := time.Duration(blocks[6]-80) * 15 * time.Minute
date = date.Add(diff)
} else {
// was positive, so make UTC
diff := time.Duration(blocks[6]) * 15 * time.Minute
date = date.Add(-diff)
}
Also func (t Timestamp) PDU() needs to be modified
func (t *Timestamp) ReadFrom(octets []byte) in sms.go calculate timezone offset as follow:
In accordance with GSM 03.**: The Time Zone indicates the difference, expressed in quarters of an hour, between the local time and GMT. In the first of the two semi-octets, the first bit (bit 3 of the seventh octet of the TP-Service CentreTime-Stamp ield) represents the algebraic sign of this difference (0 : positive, 1 : negative)
But semi-octets was swapped and recoded to decimal with DecodeSemi: for example, zone +03:00 trasmitted like 0x21, but after DecodeSemi looks like 12, or zone -03:00 trasmitted like 0x29, but after DecodeSemi looks like 92,
I.e. negative offset after DecodeSemi will greater than 80 (bit 3 in seventh octet is 0x08 )
I propose to replace the code with something like follow:
Also func (t Timestamp) PDU() needs to be modified