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: v13.2.7~247^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f4d945c1204088b46b0628fe70b21162227015cd;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 (cherry picked from commit b9da0925490d4e9e964249c54e7775d9c76b1719) --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 8ba317c7c630..4d432b9e6ad1 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -397,7 +397,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_config('begin_time') or '0000'