I use Python to track the version between local SQLite and remote web page. It is useful to compare them by Last-modified and file size information from the HTTP response. I found something interesting during development.
def time_match(web,sql):
print web,sql
t1 = time.strptime(web,"%a, %d %b %Y %H:%M:%S %Z")
t2 = time.strptime(sql,"%Y-%m-%d %H:%M:%S")
print t1,t2
if t1==t2:
print "same time"
else:
print "different time"
return t1==t2
In above code, I tried to decode the time from web and SQLite into internal time and compare them. Let us check out the print screen as following:
Wed, 13 Oct 2010 01:13:26 GMT 2010-10-13 01:13:26
(2010, 10, 13, 1, 13, 26, 2, 286, 0) (2010, 10, 13, 1, 13, 26, 2, 286, -1)
different time
The result shows me that the GMT is correctly decoded, while the default timezone datetime of Python seems as -1. My system timezone is actually +8, Where is the -1 comes from? SQLite?