mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix speed issue
Erik Johnson pointed out the speed issue with compelling numbers: >>> import timeit >>> t1 = timeit.Timer('clock == "localtime"', 'clock = "localtime"') >>> t2 = timeit.Timer('clock.__eq__("localtime")', 'clock = "localtime"') >>> t1.repeat() [0.061421871185302734, 0.0285952091217041, 0.026736021041870117] >>> t2.repeat() [0.1310901641845703, 0.09536910057067871, 0.09479284286499023] I'll absolutely fix it by using the simple '==' operator. Thank you!
This commit is contained in:
parent
a41146730a
commit
a6a446121a
1 changed files with 1 additions and 1 deletions
|
@ -404,7 +404,7 @@ def set_hwclock(clock):
|
|||
raise SaltInvocationError(
|
||||
'Only \'UTC\' and \'localtime\' are allowed'
|
||||
)
|
||||
if clock.__eq__('localtime'):
|
||||
if clock == 'localtime':
|
||||
clock = 'local'
|
||||
__salt__['file.sed'](
|
||||
'/etc/conf.d/hwclock', '^clock=.*', 'clock="{0}"'.format(clock))
|
||||
|
|
Loading…
Add table
Reference in a new issue