Fix value of stored SMS validity time.

Quote the argument to sqlite's datetime(). Otherwise, the timestamp
stored in the database reads back as a negative value for some reason.

Before:

1032            validity_timestamp = dbi_result_get_datetime(result, "valid_until");
(gdb) p validity_timestamp
$2 = -1516814654

After:

1032            validity_timestamp = dbi_result_get_datetime(result, "valid_until");
(gdb) p validity_timestamp
$2 = 1516814654

Change-Id: Icf786f9b1efabfe7407fb6414ec0d326d8f7244a
This commit is contained in:
Stefan Sperling 2018-01-22 18:27:25 +01:00 committed by Harald Welte
parent b8c0cf8d09
commit 3b26f34950
1 changed files with 1 additions and 1 deletions

View File

@ -711,7 +711,7 @@ int db_sms_store(struct gsm_sms *sms)
"user_data, text, "
"dest_addr, dest_ton, dest_npi, "
"src_addr, src_ton, src_npi) VALUES "
"(datetime('%lld', 'unixepoch'), datetime(%lld, 'unixepoch'), "
"(datetime('%lld', 'unixepoch'), datetime('%lld', 'unixepoch'), "
"%u, %u, %u, "
"%u, %u, %u, "
"%u, "