aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-09-26 16:15:15 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-09-26 17:13:06 +0200
commit2da2179e82232878ddc95bbeda8f593bea6537b6 (patch)
treeb87352d8b8dcfcfab6912f90fca129f4b6afd99a
parentedfd86b29596e17a4bec30651a765398e0ee409d (diff)
cosmetic: sccp_scoc.c: fix timers definition units
The SCCP timer units are not what the comments say: Milliseconds are 1000 * seconds, not 100. Also, microseconds are 1000000 * seconds. Interestingly enough, MSEC_TO_US() tried to fix the wrong hundredth-seconds to microseconds by multiplying by 10, however, it should end up at a factor of a million, not a thousand, hence would result in wrong sub-second fractions. But, since none of the current timers use sub-second fractions, none of the timers are actually affected in practice. Hence this patch is merely cosmetic. Since all use of the timer constants is wrapped in MSEC_TO_US(), we can transparently fix all those values and their use: - define the constants in milliseconds (replace "100" with "1000"). - in MSEC_TO_US(), divide-and-mod by 1000. - in MSEC_TO_US(), actually calculate microseconds. BTW, I am about to make the timers VTY configurable, but before I get confused, I'd rather fix these units first. Change-Id: Ia6c893f734fbdc88873c4ef80f6cacf01ee7763a
-rw-r--r--src/sccp_scoc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 3de986d..1057be0 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -65,18 +65,18 @@
#define SCU_MSGB_SIZE 1024
/* Appendix C.4 of Q.714 (all in milliseconds) */
-#define CONNECTION_TIMER ( 1 * 60 * 100)
-#define TX_INACT_TIMER ( 7 * 60 * 100) /* RFC 3868 Ch. 8. */
-#define RX_INACT_TIMER (15 * 60 * 100) /* RFC 3868 Ch. 8. */
-#define RELEASE_TIMER ( 10 * 100)
-#define RELEASE_REP_TIMER ( 10 * 100)
-#define INT_TIMER ( 1 * 60 * 100)
-#define GUARD_TIMER (23 * 60 * 100)
-#define RESET_TIMER ( 10 * 100)
+#define CONNECTION_TIMER ( 1 * 60 * 1000)
+#define TX_INACT_TIMER ( 7 * 60 * 1000) /* RFC 3868 Ch. 8. */
+#define RX_INACT_TIMER (15 * 60 * 1000) /* RFC 3868 Ch. 8. */
+#define RELEASE_TIMER ( 10 * 1000)
+#define RELEASE_REP_TIMER ( 10 * 1000)
+#define INT_TIMER ( 1 * 60 * 1000)
+#define GUARD_TIMER (23 * 60 * 1000)
+#define RESET_TIMER ( 10 * 1000)
/* convert from single value in milliseconds to comma-separated
* "seconds, microseconds" format we use in osmocom/core/timers.h */
-#define MSEC_TO_S_US(x) (x/100), ((x%100)*10)
+#define MSEC_TO_S_US(x) (x/1000), ((x%1000)*1000)
/***********************************************************************
* SCCP connection table