]> arthur.barton.de Git - bup.git/commitdiff
helpers.localtime: avoid floor-related deprecation warning
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 26 May 2020 22:34:54 +0000 (00:34 +0200)
committerRob Browning <rlb@defaultvalue.org>
Sun, 13 Sep 2020 17:49:25 +0000 (12:49 -0500)
floor() returns a float, even though it just rounded down,
so we need to convert to an int() to avoid a deprecation
warning here.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/helpers.py

index 788efb07a9c4ffb30a414a4cbf6dd211104748ae..2b0b6ed2c6ddeee83c686b422961beb68d375826 100644 (file)
@@ -1128,7 +1128,7 @@ if _localtime:
 # module, which doesn't appear willing to ignore the extra items.
 if _localtime:
     def localtime(time):
-        return bup_time(*_helpers.localtime(floor(time)))
+        return bup_time(*_helpers.localtime(int(floor(time))))
     def utc_offset_str(t):
         """Return the local offset from UTC as "+hhmm" or "-hhmm" for time t.
         If the current UTC offset does not represent an integer number