FW: Validity Period wrong calculation in SMPP code

"Hillel Bilman" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Is this correct?
-----Original Message-----
From: [email protected] [mailto:[email protected]]On
Behalf Of Roberto Carlos Navas
Sent: Sunday, November 14, 2004 4:07 PM
To: [email protected]
Subject: Validity Period wrong calculation in SMPP code


I know this is not the place, but I didn't want to subscribe to the
developers list... (i'm lazy)
I found a problem with the way the local timezone is determined in the
SMPP code... this timezone is used to calculate the validity period
field in the PDU.
The current method for calculation is getting the localtime and then
the GMTtime... doing a substraction and then getting the difference in
hours... the problem arise when the localtime is let's say: 20:00 and
GMTtime is 02:00 the next day... the expected result should be GMT-6.
Here is how I solved it on Linux... don't know how portable is the code
to other platforms... but the developers will find a better solution:

diff -r gateway-1.3.2/gw/smsc/smsc_smpp.c
gateway-1.3.2-telemovil/gw/smsc/smsc_smpp.c
539a540,542
 >     extern long timezone;
 >
 >     tzset();
690a694,696
 > /*    The following formula to find out the local timezone is wrong
 >       the test case is when localtime is 20:00 and timezone is GMT-6
 >
692a699,700
 > */
 >       gwqdiff = ((timezone / 900) * -1);

Regards,
______________________________________________
Roberto Carlos Navas
SubGerente Técnico de Internet
Telemovil El Salvador
Centro Financiero Gigante, Torre "D", Piso 9
San Salvador, El Salvador
Mobile: +503 8832010
NOC: +503 2080008
Fax: +503 2809450
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.