What's the Time?
Whether you are recovering from an unexpected power loss or simply need to sync with the latest time, you can use the AT-MSSTM
command to retrieve Iridium network time. This command returns the current time as a 32-bit unsigned number that represents the number of 90-millisecond frames elapsed since the start of the new Iridium Time Era (ERA2).
Background on Iridium Time Eras
- ERA2 began on May 11, 2014, at 14:23:55 UTC/GMT.
- ERA1 started on March 8, 2007, at 03:50:21.00 UTC/GMT.
- Both ERA1 and ERA2 differ from the UNIX epoch, which started on January 1, 1970, and counts the number of seconds since that time.
Future changes in Iridium time epochs will significantly alter the number returned by AT-MSSTM. Always ensure that your time conversion logic is based on the most recent information regarding Iridium time epochs.
How to Query Iridium Time
/* Request Iridium time */
AT-MSSTM\r
/* Receive Response */
-MSSTM: <system_time>\r
Decoding Iridium System Time Using Python
To accurately interpret the Iridium system time reported by the AT-MSSTM
command, you can use a Python script to convert the hexadecimal value returned by the modem into a readable datetime format. This process calculates the number of 90-millisecond intervals since the start of the Iridium ERA2 epoch and converts it to a standard datetime.
Here's the Python script that performs the conversion:
import datetime
# Hexadecimal value provided by the SBD modem
hex_value = "d1c6dd38" # Replace with your hexadecimal value from AT-MSSTM
# ERA2 epoch for Iridium system time
era2_epoch = datetime.datetime(2014, 5, 11, 14, 23, 55)
# Convert the hexadecimal string to a decimal number representing the count of 90 ms intervals
interval_count = int(hex_value, 16)
# Calculate the total milliseconds since the epoch
total_milliseconds = interval_count * 90
# Create a timedelta with the total milliseconds
time_delta = datetime.timedelta(milliseconds=total_milliseconds)
# Calculate the exact datetime by adding the timedelta to the epoch
decoded_time = era2_epoch + time_delta
# Output the decoded time
print(f"Decoded Iridium Time: {decoded_time}")
Result:
Decoded Iridium Time: 2024-05-24 17:10:16.360000
Usage
- Replace hex_value with the hexadecimal string returned by your AT-MSSTM command.
- Run the script in a Python environment.
- The output will display the decoded datetime in UTC, giving you a precise timestamp according to Iridium’s system time.