time.ctime() is a string representation. This will have problems with DST and locales. Better use time.time().