How to check if datetime is older than 20 seconds.

Posted by Jelle on Stack Overflow See other posts from Stack Overflow or by Jelle
Published on 2010-03-07T22:14:22Z Indexed on 2010/03/08 1:35 UTC
Read the original article Hit count: 380

Hello! This is my first time here so I hope I post this question at the right place. :)

I need to build flood control for my script but I'm not good at all this datetime to time conversions with UTC and stuff. I hope you can help me out. I'm using the Google App Engine with Python. I've got a datetimeproperty at the DataStore database which should be checked if it's older than 20 seconds, then proceed.

Could anybody help me out?

So in semi-psuedo:

q = db.GqlQuery("SELECT * FROM Kudo WHERE fromuser = :1", user)
lastplus = q.get()

if lastplus.date is older than 20 seconds:
print"Go!"

© Stack Overflow or respective owner

Related posts about python

Related posts about google-app-engine