参考:
8.1. datetime — Basic date and time types — Python 2.7.12 documentation
Python timedelta – 我的成长之路 http://foofish.net – ITeye技术网站
好像是:
curDatetimeDelta = curDatetime – updateLocationTime gLog.debug(“curDatetimeDelta=%s”, curDatetimeDelta) pastSeconds = curDatetimeDelta.total_seconds() gLog.debug(“pastSeconds=%s”, pastSeconds) |
应该是的。
另外也有别人这么用:
<code> @property def is_online(self): if not self.location: return False if (datetime.now() - self.location.updatedAt).total_seconds() > 60: return False else: return True </code>