in core/src/main/scala/org/apache/pekko/persistence/cassandra/query/scaladsl/CassandraReadJournal.scala [231:259]
def offsetUuid(timestamp: Long): UUID =
if (timestamp == 0L) firstOffset else Uuids.startOf(timestamp)
/**
* Create a time based UUID that can be used as offset in `eventsByTag`
* queries. The `timestamp` is a unix timestamp (as returned by
* `System#currentTimeMillis`).
*/
def timeBasedUUIDFrom(timestamp: Long): Offset =
if (timestamp == 0L) NoOffset
else TimeBasedUUID(offsetUuid(timestamp))
/**
* Convert a `TimeBasedUUID` to a unix timestamp (as returned by
* `System#currentTimeMillis`).
*/
def timestampFrom(offset: TimeBasedUUID): Long =
Uuids.unixTimestamp(offset.value)
/**
* Convert a `TimeBasedUUID` to a unix timestamp (as returned by
* `System#currentTimeMillis`. If it's not a `TimeBasedUUID` it
* will return 0.
*/
private def timestampFrom(offset: Offset): Long =
offset match {
case t: TimeBasedUUID => timestampFrom(t)
case _ => 0
}