8 Mar
2014
8 Mar
'14
6:58 p.m.
Alexander Chemeris wrote:
+++ b/openbsc/src/libmsc/gsm_04_11.c @@ -102,6 +102,10 @@ struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, sms->protocol_id = 0; /* implicit */ sms->data_coding_scheme = dcs; strncpy(sms->dst.addr, receiver->extension, sizeof(sms->dst.addr)-1); + /* Timestamps */ + time(&sms->received_time); + time(&sms->valid_until); + sms->valid_until += SMS_DEFAULT_VALIDITY_PERIOD;
In order to make this a bit more atomic I'd suggest replacing the second time() with reuse of the first value. sms->valid_until = sms->received_time + SMS_DEFAULT_VALIDITY_PERIOD; The INSERT statement change is pretty gross but oh well. //Peter