From b9da0925490d4e9e964249c54e7775d9c76b1719 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 19 Feb 2019 18:36:25 +0800 Subject: [PATCH] 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 --- src/pybind/mgr/balancer/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 638a4337f522f..8ed3dbac686df 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') -- 2.47.3