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
--- 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 {

Attachment: msg04711/pgp00000.pgp
Description: PGP signature

Reply via email to