Skip to content


Subversion checkout URL

You can clone with
Download ZIP


EXPIREAT & timezones #1016

defransen opened this Issue · 9 comments

9 participants


EXPIREAT uses unixtimestamps which normaly are expected to be in UTC timezone, but redis uses the servers local timezone.
A simple solution would be to make the used timezone configurable.








Hello, I don't understand the issue (and the +1s) very well. EXPIREAT uses unix timestamps, so it is an absolute time whatever the server setting is, and timezones should not have any role at all. Can you specify very well the meaning of the issue and show an example? Thank you.


The expiration internally uses gettimeofday to get the current date, which should be expressed as seconds and microseconds since the Epoch (according to the man page), so the intended behaviour matches the documented one.


FWIW I don't really understand either. I think it's better to use UTC timestamps. I am unclear on where the disconnect is happening, but I could be missing something obvious.


I investigated and tested a little more:
The error is actually in redis-py (it uses time.mktime which assumes a naive datetime in local TZ, I and probably the "+1"s try to use aware datetimes with pytz)
As antirez and badboy say Redis' behaviour itself is exactly as intended.
Sorry for causing the noise.

@defransen defransen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.