On Sat, Mar 8, 2014 at 7:58 PM, Peter Stuge <peter(a)stuge.se> wrote:
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;
Good idea. Not sure why I didn't have this before.
I've updated the branch.
--
Regards,
Alexander Chemeris.
CEO, Fairwaves, Inc. / ООО УмРадио
https://fairwaves.co