Search code examples
parsingtimestamphexamazon-ses

What is the format of this hex timestamp from the Amazon SES message ID?


Amazon SES message IDs are in the following format:

01020170c41acd6e-89acae55-6245-4d89-86ca-0a177e59e737-000000

This seems to consist of 3 distinct parts

  1. 01020170c41acd6e appears to be some sort of hex timestamp. The difference between two timestamps is the time elapsed in milliseconds but it doesn't seem to begin at epoch
  2. c2daf94a-f258-4d59-8fdb-a5512d4c7638 is clearly a standard version 4 UUID
  3. 000000 remains the same for first sending and I assume is incremented for redelivery attempts

I have a need to generate a 'fake' message ID in some scenarios. It is trivial to fake 2 and 3 above however I cannot seem to deduce what the format of the timestamp above is. Here are some further examples with corresponding approximate times:

  • 01020170c450e280 - Mar 10, 2020 at 12:00:00.190
  • 01020170c44c2e6a - Mar 10, 2020 at 11:54:51.987
  • 01020170c0e30119 - Mar 09, 2020 at 20:01:07.407

What format is this timestamp?


Solution

  • Taking your first example of 01020170c450e280, the string can be split into 01020 and 170c450e280.

    170c450e280 hex == 1583841600128 dec == 2020-03-10T12:00:00.128Z.

    However, I'm afraid that the 01020 prefix remains a mystery to me.