New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMSD DeliveryReports: DeliveryDateTime does not include timezone #363

Closed
melones opened this Issue Oct 11, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@melones

melones commented Oct 11, 2017

Hi,
gammu-smsd: 1.38.5 (master)
cellular-op: different operators in PL

When a delivery report is received it is saved to DB with a datetimestamp without timezone. As a result I get a situation like DeliveryDateTime was received 2 hours before sending a message :)

ID | SendingDateTime | DeliveryDateTime | Status
------+---------------------+---------------------+------------
4877 | 2017-10-11 13:36:12 | 2017-10-11 11:36:13 | DeliveryOK

I did a small research on this:
Default SQL takes the DeliveryDateTime value from SMSCTime:
UPDATE sentitems SET DeliveryDateTime = %C, Status = %1, StatusError = %e WHERE ID = %2 AND TPMR = %t

case 'C':
SMSDSQL_Time2String(Config, Fill_Time_T(sms->SMSCTime), static_buff, sizeof(static_buff));
to_print = static_buff;
break;

And as I understand the SMSCTime should be adjusted in method Fill_Time_T() with timezone.

#ifdef HAVE_STRUCT_TM_TM_ZONE
/* No time zone information */
timestruct.tm_gmtoff = now->tm_gmtoff;
timestruct.tm_zone = now->tm_zone;
#endif

However somehow it is not.
I thought that maybe during compilation timezone references in Fill_Time_T() are not added. But I checked the compilation log and it seems that everything was ok:

Performing C SOURCE FILE Test HAVE_STRUCT_TM_TM_ZONE succeeded with the following output:
Change Dir: /mnt/nand-user/temp/source/gammu-1.38.5/CMakeFiles/CMakeTmp
etc...

Database (Postgres) function now() returns correct time (including timezone). System timezone setting is also ok.

Am I wrong somewhere in my research? What could be the reason that the timezone is not taken into account?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@nijel

This comment has been minimized.

Show comment
Hide comment
@nijel

nijel Oct 16, 2017

Member

Duplicate of #305

Member

nijel commented Oct 16, 2017

Duplicate of #305

@nijel nijel marked this as a duplicate of #305 Oct 16, 2017

@nijel nijel closed this Oct 16, 2017

@nijel nijel added bug smsd labels Oct 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment