ZODB.Persistent Objects.TimeStamp
Documentation
TimeStamps objects provide a way to efficiently, precisely, and portably manage date and time information as strings.
8-character representation
The primary reason for the existence of of the TimeStamp class is to provide efficient precise string representation of date and time information for use as transaction identifiers and object serial numbers.
The first 4 bytes of the string representation encode the date and time as a 32-bit big-endian unsigned integer computed from:
(((((year-1900)*12)+month-1)*31+day-1)*24+hour)*60+minute
The last 4 bytes of the string seconds part of the date and time as a 32-bit big-endian unsigned integer computed from:
seconds * (1 << 32) / 60
This provides dates and times that are year 9900 compliant
Current Time
To compute a TimeStamp for the current time, use:
import time
t=time.time()
ts=TimeStamp(time.gmtime(t)[:5], t%60)