gfc-timeuuid
![Coverage Status](https://camo.githubusercontent.com/6b73c57bfa3bef8dc3c48435df931842d7d51e61acf09f043a2ba8e2fc75cd15/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6766632d636f6c6c6563746976652f6766632d74696d65757569642f62616467652e7376673f6272616e63683d6d61696e26736572766963653d676974687562)
An Scala timeuuid library for generating version 1 UUIDs, based on http://www.ietf.org/rfc/rfc4122.txts.
This library is a fork and new home of the now unmaintained Gilt Foundation Classes (com.gilt.gfc
), now called the GFC Collective, maintained by some of the original authors.
Getting gfc-timeuuid
The latest version is 1.0.0, released on 21/Jan/2020 and cross-built against Scala 2.12.x and 2.13.x.
If you're using SBT, add the following line to your build file:
libraryDependencies += "org.gfccollective" %% "gfc-timeuuid" % "1.0.0"
For Maven and other build tools, you can visit search.maven.org. (This search will also list other available libraries from the GFC Collective.)
Contents and Example Usage
Generates a new unique time based UUID
val uuid = TimeUuid()
Convert time UUID to unix timestamp
import org.gfccollective.timeuuid._
val uuid = TimeUuid()
val timestamp = uuid.toLong
Convert time UUID to unix date
import org.gfccollective.timeuuid._
val uuid = TimeUuid()
val date = uuid.toDate
Convert arrays of 16 bytes to UUID:
val bytes = new Array[Byte](16)
val uuid = bytes.toUUID
License
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0