有没有办法在PHP中追溯创建基于时间/节点的UUID? [英] Is there a way to retroactively create time/node based UUID in PHP?
问题描述
使用当前时间创建大多数基于时间的(类型1)UUID.我正在将MySQL数据库迁移到cassandra,并想为已归档项目创建基于时间的UUID.有人可以提供一个示例来说明如何使用过去的时间段创建Type-1 UUID吗?
Most time-based (type 1) UUIDs are created using the current time. I'm migrating a MySQL database to cassandra and would like to create timebased UUIDs for archived items. Can someone provide an example of how type-1 UUIDs are created using past time periods?
推荐答案
所有uuid版本1都是节点标识符(MAC地址),时间戳和随机种子的组合.
All uuids version 1 are a combination of node identifier (MAC address), timestamp and a random seed.
是可能的.这个过程是可逆的.
Yes its possible. The process is reversible.
从 RFC4122 中了解有关UUID版本1的时间戳部分(第4.1.4节) ):
From RFC4122 about the timestamp part of UUID version 1 (section 4.1.4):
"对于UUID版本1,这是 以协调世界大会为代表 时间(UTC)以 从此开始每100纳秒间隔 1582年10月15日,00:00:00.00(日期 格里高利对基督教的改革 日历).
"For UUID version 1, this is represented by Coordinated Universal Time (UTC) as a count of 100-nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar)."
用于创建时基UUID(uuid)的基本算法(第4.2.1 节)版本1)
这篇关于有没有办法在PHP中追溯创建基于时间/节点的UUID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!