# formula is wrong: if the timezone, for example, is 4h and 30m = 18 times 15 minutes,
# 18 / 4 = 4,5 and RouterOS do not suport decimal division.
Can you explain the correct algorithm in simple words? And preferably in another topic, so that it is in the right place.
On the follow example, is supposed GMT-07:00
1) Read from PDU "8A"
2) Split the string, but read first the last, because on PDU the characters are inverted.
I call the variables x and y for not confuse "A" with a.
x = A, y = 8
A on bit are 1010, and the GSM rule say "if the first bit is 1, the timezone is negative", so, is negative.
now for obtain the second number, the 1st bit must be subtracted for have the right number
A (1010 binary) - 1st bit (1000 binary) = 0010
0010 binary is = 2, so we put 2 on x
since "2" and "8" must be considered literally decimal (like the phone number) and not 0x28,
2 is on decimal position, and 8 are the units, so the string x + y give the correct number for calculate how many 15 minutes are involved.
"negative sign" + "2" + "8" = "-28" and converted to number.... is -28...
At this point you have the correct timezone -28 times 15 minutes = -420 minutes.
and for convert minuntes on hours:minutes
-420 / 60 = -7
and do not remain any minutes, because 60 * -7 is exactly -420.
If, for example, we have on PDU 22 (India +05:30), is the same:
x = 2, y = 2, timezone is positive, because x (0010) <= 7 (0111)
so, "positive" + "2" + "2" = +22 = 22 times 15 = 330 minutes = 5 hours and ½ hour = 5 hours and 30 minutes
If, for example, we have on PDU 83 (Central Australia +09:30), is the same:
x = 3, y = 8, timezone is positive, because x (0011) <= 7 (0111)
so, "positive" + "3" + "8" = +38 = 38 times 15 = 570 minutes = 9 hours and ½ hour = 9 hours and 30 minutes
If, for example, we have on PDU 49 (America/St Johns -03:30), is the same:
x = 9, y = 4, timezone is NEGATIVE, because x (1001) > 7 (0111)
x = x - (1000) = 1
so, "negative" + "1" + "4" = -14 = -14 times 15 = -210 minutes = -3 hours and ½ hour = -3 hours and 30 minutes
Actuallu the timezones go from -11 (Pacific/Niue and Pacific/Pago_Pago) to +14 (Pacific/Kiritimati) and can end only with :00 or :30 or :45, but actually... every year something change....