ULID (Universally Unique Lexicographically Sortable Identifier) in Ada

Just added an Ada implementation of ULID (Universally Unique Lexicographically Sortable Identifier), basically a combination of a time stamp and a random number.


Great work! Do you plan on adding the monotonicity and byte order portions of the specification in a later update(s) or is this something we need to implement on the client side? No problem either way, but wanted to know for future planning.

The monotonic variant is just in:

Also the network byte order is implemented:

Oh nice! Great work again!

For some reason this doesn’t compile with 64-bit ObjectAda. I tried to make a version that would compile with it, but it failed with Time_Error, because Duration'Last is a bit over 131000. I created a function to calculate the time in milliseconds between now and the Unix epoch, but then I ran into what seem to be compiler errors, though not consistent enough to generate an error report.

I tried a different approach and managed to produce a version that works with ObjectAda 10.5. Found and reported a problem with Discrete_Random in the process.

1 Like