Message226222
time.time() returns the current time in seconds since Epoch
it is neither local nor UTC time. It can be converted to both.
You can get local time using datetime.fromtimestamp(ts).
You can get UTC time using datetime.utcfromtimestamp(ts) or
to get an aware datetime object: datetime.fromtimestamp(ts, timezone.utc), where ts is the timestamp in seconds since Epoch.
I don't know whether there is an issue with cookie.is_expired() but it
is incorrect to use time.mktime() with UTC time tuple unless the local
time is UTC. To get the timestamp from a datetime object, you could
use .timestamp() method instead:
from datetime import datetime, timezone
now = datetime.now(timezone.utc) # the current time
seconds_since_epoch = now.timestamp()
seconds_since_epoch = time.time() # might be less precise |
|
Date |
User |
Action |
Args |
2014-09-01 09:17:06 | akira | set | recipients:
+ akira, terry.reedy, regu0004 |
2014-09-01 09:17:05 | akira | set | messageid: <1409563025.93.0.00957645105775.issue22296@psf.upfronthosting.co.za> |
2014-09-01 09:17:05 | akira | link | issue22296 messages |
2014-09-01 09:17:05 | akira | create | |
|