From: xie xingguo Date: Tue, 19 Feb 2019 10:36:25 +0000 (+0800) Subject: mgr/balancer: make weekday be compatible with C X-Git-Tag: v14.1.0~53^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b9da0925490d4e9e964249c54e7775d9c76b1719;p=ceph.git mgr/balancer: make weekday be compatible with C The __desc__ field of **begin[end]_weekend** suggests sunday is the prevailing start of the week, whereas the Python implementation says no. See https://stackoverflow.com/questions/21045569/why-is-pythons-weekday-different-from-tm-wday-in-c Signed-off-by: xie xingguo --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 638a4337f52..8ed3dbac686 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -565,7 +565,7 @@ class Module(MgrModule): def time_permit(self): local_time = time.localtime() time_of_day = time.strftime('%H%M', local_time) - weekday = local_time.tm_wday + weekday = (local_time.tm_wday + 1) % 7 # be compatible with C permit = False begin_time = self.get_module_option('begin_time')