Skip to content

Conversation

@umeldt
Copy link
Contributor

@umeldt umeldt commented Dec 8, 2024

Providing the number of seconds since the UNIX epoch as the first argument to uuid7() creates a UUIDv7 from that timestamp instead of the default current time:

sqlite> .load dist/uuid
sqlite> select uuid7(0);
00000000-0000-7a9f-8e13-8c7852c6ea51
sqlite> select uuid7(1733668387);
0193a6b0-38b8-7762-9ca0-048beb946261

Not sure if this is too much of a niche use-case, but I've seem similar functionality in other libraries that implement UUIDv7.

@umeldt umeldt changed the title Allows setting an explicit timestamp (as seconds from epoch) when creating a UUIDv7 timestamp Allows setting an explicit timestamp when creating a UUIDv7 timestamp Dec 8, 2024
@umeldt umeldt changed the title Allows setting an explicit timestamp when creating a UUIDv7 timestamp Allows setting an explicit timestamp when creating a UUIDv7 Dec 8, 2024
@umeldt umeldt changed the title Allows setting an explicit timestamp when creating a UUIDv7 Allows setting an explicit timestamp when generating a UUIDv7 Dec 8, 2024
@nalgeon nalgeon merged commit ac10ca6 into nalgeon:main Dec 8, 2024
1 of 3 checks passed
@nalgeon
Copy link
Owner

nalgeon commented Dec 8, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants