mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-03 08:20:28 +00:00
Add link to rfc
This commit is contained in:
parent
edc28828d4
commit
e3897ffd90
1 changed files with 2 additions and 1 deletions
|
@ -859,6 +859,7 @@ int LuaUuidV4(lua_State *L) {
|
|||
}
|
||||
|
||||
int LuaUuidV7(lua_State *L) {
|
||||
//See https://www.rfc-editor.org/rfc/rfc9562.html
|
||||
char bin[16], uuid_str[37];
|
||||
struct timespec ts = timespec_real();
|
||||
uint64_t unix_ts_ms = (uint64_t)((ts.tv_sec * 1000) + (ts.tv_nsec / 1000000));
|
||||
|
@ -903,7 +904,7 @@ int LuaUuidV7(lua_State *L) {
|
|||
uuid_str[17] = "0123456789abcdef"[(bin[7] & 0xf0) >>4];
|
||||
uuid_str[18] = '-';
|
||||
uuid_str[19] = "0123456789abcdef"[(0x8 | ((bin[7] & 0x0f) >>2))];
|
||||
uuid_str[20] = "0123456789abcdef"[(bin[7] & 0x03) | (bin[8] & 0xf0) >>6];
|
||||
uuid_str[20] = "0123456789abcdef"[(bin[7] & 0x03) | (bin[8] & 0xf0) >>6]; //See https://www.rfc-editor.org/rfc/rfc9562.html#version_field
|
||||
uuid_str[21] = "0123456789abcdef"[(bin[8] & 0x0f)];
|
||||
uuid_str[22] = "0123456789abcdef"[(bin[9] & 0xf0) >>4];
|
||||
uuid_str[23] = '-';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue