Change in libosmo-sccp[master]: cosmetic: sccp_scoc.c: fix timers definition units

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Sep 27 00:49:35 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/11110


Change subject: cosmetic: sccp_scoc.c: fix timers definition units
......................................................................

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
---
M src/sccp_scoc.c
1 file changed, 9 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/10/11110/1

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

-- 
To view, visit https://gerrit.osmocom.org/11110
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6c893f734fbdc88873c4ef80f6cacf01ee7763a
Gerrit-Change-Number: 11110
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180927/9eeb4909/attachment.htm>


More information about the gerrit-log mailing list