I'm inserting a bunch of data to sql database that also has timestamp attribute (accepting only INTEGER to save space).
There are always a bunch of data being inserted at once and they are not gonna take more than a few seconds to insert. The timestamp is only used as an indicator as to when was the last time the data was updated, and to fetch the last data (GROUP BY timestamp).
What is the most efficient way round the timestamp to the nearest minute?
One (I guess very inefficient) way would be:
Edit:
from time import time
def getTime():
ts = time.now()
return ts - ts & 60
Aucun commentaire:
Enregistrer un commentaire