File: gen_uuid7.py

package info (click to toggle)
python-uuid-extension 0.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176 kB
  • sloc: python: 228; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import time

from uuid_extension import uuid7

# Example usage
print(f"UUIDv7: {repr(uuid7())}")
print(f"UUIDv7 string: {uuid7()}")

# Generate a few UUIDs to show time ordering

print("\nMultiple UUIDs (should be time-ordered):")
for _ in range(5):
    u = uuid7()
    print(u, "->", u.to_datetime(), "->", u.to_timestamp())
    time.sleep(0.1)  # Small delay to see time difference