]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: make weekday be compatible with C 26505/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 19 Feb 2019 10:36:25 +0000 (18:36 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 19 Feb 2019 11:31:32 +0000 (19:31 +0800)
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 <xie.xingguo@zte.com.cn>
src/pybind/mgr/balancer/module.py

index 638a4337f522fd5922ac9e18cb093a61fe22ffbe..8ed3dbac686df473836c5cde8bc5adce2f8f119c 100644 (file)
@@ -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')