{"id":51065339,"url":"https://github.com/lefred/mariadb-plugin-uuid-time","last_synced_at":"2026-06-23T06:01:32.417Z","repository":{"id":365657328,"uuid":"1272087676","full_name":"lefred/mariadb-plugin-uuid-time","owner":"lefred","description":"MariaDB function plugin that extracts timestamps from UUID values","archived":false,"fork":false,"pushed_at":"2026-06-18T08:51:14.000Z","size":317,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-18T10:25:38.601Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lefred.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-17T09:23:22.000Z","updated_at":"2026-06-18T08:51:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lefred/mariadb-plugin-uuid-time","commit_stats":null,"previous_names":["lefred/mariadb-plugin-uuid-time"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lefred/mariadb-plugin-uuid-time","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmariadb-plugin-uuid-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmariadb-plugin-uuid-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmariadb-plugin-uuid-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmariadb-plugin-uuid-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lefred","download_url":"https://codeload.github.com/lefred/mariadb-plugin-uuid-time/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmariadb-plugin-uuid-time/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34677402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-23T06:01:31.373Z","updated_at":"2026-06-23T06:01:32.387Z","avatar_url":"https://github.com/lefred.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mariadb-plugin-uuid-time\n\n![mariabd-plugin-uuid-time](logo/uuid_timestamp.png)\n\nMariaDB function plugin that extracts timestamps from UUID values when the\ntimestamp is encoded in the UUID. It supports UUID version 1 and UUID version 7.\n\nThe plugin provides five SQL functions:\n\n| Function | Description |\n| --- | --- |\n| `uuid_to_timestamp(uuid)` | Returns the embedded timestamp as `YYYY-MM-DD HH:MM:SS.mmm` |\n| `uuid_to_timestamp_long(uuid)` | Returns the embedded timestamp in the server process locale/timezone format |\n| `uuid_to_unixtime(uuid)` | Returns the embedded timestamp as Unix time in seconds |\n| `uuid_age(uuid)` | Returns the age of the UUID timestamp in fractional seconds |\n| `uuid_age_long(uuid)` | Returns the age as `3y 3mo 12d 12h 21m 13.293s` |\n\nValid UUIDs that do not contain a timestamp, such as UUIDv4 values, return\n`NULL`. Invalid UUID strings raise an error.\n\n## Build\n\nThis plugin is intended to be built as part of a MariaDB source tree. Place the\nplugin directory under the MariaDB plugin directory and build MariaDB with the\nplugin enabled.\n\nThe CMake target builds the module as `uuid_time`.\n\n## Installation\n\nInstall the plugin module in MariaDB:\n\n```sql\nINSTALL SONAME 'uuid_time';\n```\n\nVerify that the five function plugins are loaded:\n\n```sql\nSELECT plugin_name, plugin_type, plugin_library, plugin_description,\n       plugin_author\nFROM information_schema.PLUGINS\nWHERE plugin_type = 'FUNCTION'\n  AND plugin_library = 'uuid_time.so'\nORDER BY plugin_name;\n```\n\nExpected functions:\n\n```text\n+------------------------+-------------+----------------+-----------------------------------+---------------+\n| plugin_name            | plugin_type | plugin_library | plugin_description                | plugin_author |\n+------------------------+-------------+----------------+-----------------------------------+---------------+\n| uuid_to_timestamp      | FUNCTION    | uuid_time.so   | Function UUID_TO_TIMESTAMP()      | lefred        |\n| uuid_to_timestamp_long | FUNCTION    | uuid_time.so   | Function UUID_TO_TIMESTAMP_LONG() | lefred        |\n| uuid_to_unixtime       | FUNCTION    | uuid_time.so   | Function UUID_TO_UNIXTIME()       | lefred        |\n| uuid_age               | FUNCTION    | uuid_time.so   | Function UUID_AGE()               | lefred        |\n| uuid_age_long          | FUNCTION    | uuid_time.so   | Function UUID_AGE_LONG()          | lefred        |\n+------------------------+-------------+----------------+-----------------------------------+---------------+\n```\n\nUninstall the plugin module:\n\n```sql\nUNINSTALL SONAME 'uuid_time';\n```\n\n## Examples\n\nThe timestamp string functions use the server process timezone. Exact displayed\nhours can differ by environment, but the Unix timestamp represents the same\ninstant.\n\n### `uuid_to_timestamp()`\n\nConvert a UUIDv1 value:\n\n```sql\nSELECT uuid_to_timestamp('a00c9994-6a13-11f1-b6b2-5e1b9081e705');\n```\n\nExample result:\n\n```text\n+----------------------------------------------------------------+\n| uuid_to_timestamp('a00c9994-6a13-11f1-b6b2-5e1b9081e705')      |\n+----------------------------------------------------------------+\n|  2026-06-17 08:13:14.729                                       |\n+----------------------------------------------------------------+\n```\n\nConvert a UUIDv7 value:\n\n```sql\nSELECT uuid_to_timestamp('019ed437-74b1-7f54-814d-b96799236b76');\n```\n\nExample result:\n\n```text\n+----------------------------------------------------------------+\n| uuid_to_timestamp('019ed437-74b1-7f54-814d-b96799236b76')      |\n+----------------------------------------------------------------+\n| 2026-06-17 08:14:24.689                                        |\n+----------------------------------------------------------------+\n```\n\nUse generated UUIDs:\n\n```sql\nSELECT uuid_to_timestamp(UUID()) AS uuid_v1_timestamp,\n       uuid_to_timestamp(UUID_v7()) AS uuid_v7_timestamp;\n```\n\n### `uuid_to_timestamp_long()`\n\nReturn a longer, locale-dependent timestamp:\n\n```sql\nSELECT uuid_to_timestamp_long('a00c9994-6a13-11f1-b6b2-5e1b9081e705');\n```\n\nExample result:\n\n```text\n+----------------------------------------------------------------+\n| uuid_to_timestamp_long('a00c9994-6a13-11f1-b6b2-5e1b9081e705') |\n+----------------------------------------------------------------+\n| Wed Jun 17 08:13:14 2026 CEST                                  |\n+----------------------------------------------------------------+\n```\n\nFor UUIDv7:\n\n```sql\nSELECT uuid_to_timestamp_long('019ed437-74b1-7f54-814d-b96799236b76');\n```\n\nExample result:\n\n```text\n+----------------------------------------------------------------+\n| uuid_to_timestamp_long('019ed437-74b1-7f54-814d-b96799236b76') |\n+----------------------------------------------------------------+\n| Wed Jun 17 08:14:24 2026 CEST                                  |\n+----------------------------------------------------------------+\n```\n\n### `uuid_to_unixtime()`\n\nReturn Unix time in seconds:\n\n```sql\nSELECT uuid_to_unixtime('896e34e0-2d0c-11ea-8000-000000000000') AS v1,\n       uuid_to_unixtime('018bcfe5-687b-7000-8000-000000000000') AS v7;\n```\n\nResult:\n\n```text\n+------------+------------+\n| v1         | v7         |\n+------------+------------+\n| 1577934245 | 1700000000 |\n+------------+------------+\n```\n\nCombine with `FROM_UNIXTIME()`:\n\n```sql\nSELECT FROM_UNIXTIME(\n         uuid_to_unixtime('018bcfe5-687b-7000-8000-000000000000')\n       ) AS uuid_v7_datetime;\n```\n\n### `uuid_age()`\n\nReturn the elapsed time since the UUID timestamp, in seconds:\n\n```sql\nSELECT uuid_age(UUID_v7());\n```\n\nThe return value is fractional, so freshly generated UUIDv7 values can show\nsub-second ages.\n\n### `uuid_age_long()`\n\nReturn the elapsed time since the UUID timestamp as a compact duration string:\n\n```sql\nSELECT uuid_age_long('0186c285-2890-79d1-a8f0-6229ba440ade');\n```\n\nExample format:\n\n```text\n3y 3mo 12d 12h 21m 13.293s\n```\n\nYears and months are calculated with UTC calendar arithmetic, so leap years and\nmonth lengths are reflected in the result.\n\n## NULL and Error Behavior\n\n`NULL` input returns `NULL`:\n\n```sql\nSELECT uuid_to_timestamp(NULL),\n       uuid_to_timestamp_long(NULL),\n       uuid_to_unixtime(NULL),\n       uuid_age(NULL),\n       uuid_age_long(NULL);\n```\n\nValid UUIDs without an embedded timestamp return `NULL`:\n\n```sql\nSELECT uuid_to_timestamp('f47ac10b-58cc-4372-a567-0e02b2c3d479') AS ts,\n       uuid_to_timestamp_long('f47ac10b-58cc-4372-a567-0e02b2c3d479') AS ts_long,\n       uuid_to_unixtime('f47ac10b-58cc-4372-a567-0e02b2c3d479') AS unix_time,\n       uuid_age('f47ac10b-58cc-4372-a567-0e02b2c3d479') AS age,\n       uuid_age_long('f47ac10b-58cc-4372-a567-0e02b2c3d479') AS age_long;\n```\n\nResult:\n\n```text\n+------+---------+-----------+\n| ts   | ts_long | unix_time |\n+------+---------+-----------+\n| NULL | NULL    | NULL      |\n+------+---------+-----------+\n```\n\nInvalid UUID text raises an error:\n\n```sql\nSELECT uuid_to_timestamp('not-a-uuid');\n```\n\nResult:\n\n```text\nERROR 1105 (HY000): uuid_to_timestamp: not a valid UUID\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefred%2Fmariadb-plugin-uuid-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flefred%2Fmariadb-plugin-uuid-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefred%2Fmariadb-plugin-uuid-time/lists"}