[PATCH] libmsc,sms: Properly calculate and store validity and received timestamps for incoming SMS.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Alexander Chemeris alexander.chemeris at gmail.com
Sat Mar 8 19:28:44 UTC 2014


On Sat, Mar 8, 2014 at 7:58 PM, Peter Stuge <peter at 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




More information about the OpenBSC mailing list