I'm trying to find an equivalent option of "uuid -d" linux command in python, and end up using below, as found in Extract the time from a UUID v1 in python :
request_id = 78577992-6170-11e8-a1e4-f3a982af936e
request_uuid = uuid.UUID(request_id)
print (datetime.fromtimestamp((request_uuid.time - 0x01b21dd213814000L)*100/1e9))
which printed the time as "2018-05-27 15:40:31.803023", which is different from the actual time shows up in "uuid -d" command:
uuid -d 78577992-6170-11e8-a1e4-f3a982af936e |grep "content: time:"
content: time: 2018-05-27 05:40:31.803022.6 UTC
Is there a correct option to extract time information from UUID in python, using uuid or any built-in modules?
Your provided request_id
is different from the uuid you test using uuid -d
. If you correct this discrepancy they correspond (checked using answers to Extract the time from a UUID v1 in python).