从ruby中的UUID v1中提取时间

我已经存储了UUID v1作为密钥的数据,现在我想知道何时生成UUID。 我怎么做那个好方法?

这适用于irb:

require 'simple_uuid' uuid = SimpleUUID::UUID.new uuid.to_guid # actually this is what I have stored in my database Time.at(SimpleUUID::UUID.new(uuid.to_guid).seconds) # returns the time and date of the UUID 

感谢我的朋友KillerFox,他向我展示了简单的解决方案。