Changed time.localtime to return proper date

time.localtme would always return current date. This resulted in odd
behaviour when using datetime.datetime.fromtimestamp and
datetime.date.fromtimestamp