Python 解密应用程序输出和服务器之间的日期时间差异
在使用redis的Django/Python应用程序中,我会:Python 解密应用程序输出和服务器之间的日期时间差异,python,linux,datetime,redis,Python,Linux,Datetime,Redis,在使用redis的Django/Python应用程序中,我会: my_server = redis.Redis(connection_pool=POOL) updated_at = time.time() object_hash = "np:"+str(object_id) sorted_set = "sn:"+str(user_id) my_server.zadd(sorted_set, object_hash, updated_at) 这是直截了当的。本质上,我维护一个排序集,其中包含按对
my_server = redis.Redis(connection_pool=POOL)
updated_at = time.time()
object_hash = "np:"+str(object_id)
sorted_set = "sn:"+str(user_id)
my_server.zadd(sorted_set, object_hash, updated_at)
这是直截了当的。本质上,我维护一个排序集,其中包含按对象更新时间排序的对象
问题是,如果我使用redis cli
获得zrange排序集0-1和分数
,则分数
显示的时间比最初在更新时的时间正好早了5小时
e、 g.如果输入了1479646405.21
,则redis排序的集合分数最终为1479628405.497179
(根据redis cli
的输出)。即落后5小时。这看起来像是时区问题-我的位置比UTC提前5小时
我的问题是:为什么在更新redis服务器时,分数会倒退5小时?每当我从应用程序中打印更新的变量时,我都会得到正确的数字。这是一个Linux问题吗(我的应用程序所在的操作系统是Ubuntu 14.04),如果是,你能准确地解释一下会发生什么吗?作为一个初学者,我试图理解这里的动态。谢谢