Re: [PATCH] SMPP validity

Vibhu Mohindra <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Thanks for the feedback.  If using localtime() is OK and so is using the
tm_gmtoff member of struct tm, then the modification becomes much simpler
and needs no changes to protected.[ch]. It's attached to this post.

I wasn't sure about the portability of the tm_gmtoff field because
its definition in my time.h had plenty of #ifdefs around it. If it is
considered portable then perhaps you'll consider this change.

Vibhu
tmp11 (text/plain, 870 B)
--- gateway.orig/gw/smsc/smsc_smpp.c	Thu Aug 22 01:11:29 2002
+++ gateway/gw/smsc/smsc_smpp.c	Thu Aug 22 18:06:51 2002
@@ -258,7 +258,7 @@
     SMPP_PDU *pdu; 
     Octstr *buffer;
     Octstr *relation_UTC_time = NULL;
-    struct tm gmtime, localtime, tm;
+    struct tm tm;
     int gwqdiff;
 
     pdu = smpp_pdu_create(submit_sm,  
@@ -359,11 +359,7 @@
     if (msg->sms.validity || msg->sms.deferred) {
 
         /* work out 1/4 hour difference between local time and UTC/GMT */
-        gmtime = gw_gmtime(time(NULL));
-        localtime = gw_localtime(time(NULL));
-        gwqdiff = ((localtime.tm_hour - gmtime.tm_hour) * 4)
-                  + ((localtime.tm_min - gmtime.tm_min) / 15);
-        
+	gwqdiff = (int) (gw_localtime(time(NULL)).tm_gmtoff/900);
         if (gwqdiff >= 0) {
             relation_UTC_time = octstr_create("+");
         } else {
signature.asc (application/pgp-signature, 232 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9ZNd8vgqsqbNQjqcRAkypAJwKT6olg/naNqNJWgxgAlXrj9F9AQCdGYc+
IkN2YIChtNzck7VvcbSRHb4=
=oheW
-----END PGP SIGNATURE-----
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.