From 136bdb065baaa2e1e178eb63587db93ccaf49a10 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 31 Jan 2023 16:23:32 +0100 Subject: [PATCH] ts_51_011: EF_SMSP: Use integer division in ValidityPeriodAdapter ValidityPeriodAdapter() must return integer values when encoding a value, as only integer values can be expressed in the binary format. Change-Id: I0b431a591ac1761d875b5697a71b6d59241db87d --- pySim/ts_51_011.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py index cd17ec8b..4d819dd7 100644 --- a/pySim/ts_51_011.py +++ b/pySim/ts_51_011.py @@ -435,11 +435,11 @@ class EF_SMSP(LinFixedEF): if obj <= 12*60: return obj/5 - 1 elif obj <= 24*60: - return 143 + ((obj - (12 * 60)) / 30) + return 143 + ((obj - (12 * 60)) // 30) elif obj <= 30 * 24 * 60: return 166 + (obj / (24 * 60)) elif obj <= 63 * 7 * 24 * 60: - return 192 + (obj / (7 * 24 * 60)) + return 192 + (obj // (7 * 24 * 60)) else: raise ValueError