Hi Dima,
 
The code you pointed just states the opposite. date_convert_universal is called when a valid emi2 timestamp is received.
 
And it uses an 1-12 index on a monthstart[12] array. That's the problem. With the change I suggest I think we can fix it.
 
My question again: what is the way to send fixes? Is there anybody responsible to commit the CVS changes?
 
-----Mensaje original-----
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]En nombre de Dima Milentiev
Enviado el: martes 15 de enero de 2002 9:12
Para: Angel Fradejas; Kannel Developers
Asunto: RE: timestamps with emi2

Hi all,

 

It seams we mix here something.

 

We do parsing but if only if we have problem we entry in branch and call  date_convert_universal():

 

 

            if (octstr_parse_long(&unitime.second, tempstr, 10, 10) != 12 ||

                (octstr_delete(tempstr, 10, 2),

                 octstr_parse_long(&unitime.minute, tempstr, 8, 10) != 10) ||

                (octstr_delete(tempstr, 8, 2),

                 octstr_parse_long(&unitime.hour, tempstr, 6, 10) != 8) ||

                (octstr_delete(tempstr, 6, 2),

                 octstr_parse_long(&unitime.year, tempstr, 4, 10) != 6) ||

                (octstr_delete(tempstr, 4, 2),

                 octstr_parse_long(&unitime.month, tempstr, 2, 10) != 4) ||

                (octstr_delete(tempstr, 2, 2),

                 octstr_parse_long(&unitime.day, tempstr, 0, 10) != 2)) {

                error(0, "EMI delivery time stamp looks malformed");

            notime:

                time(&msg->sms.time);

            }

            else {

                unitime.year += 2000; /* Conversion function expects full year */

                msg->sms.time = date_convert_universal(&unitime);

            }

 

            And about date_convert_universal in date.c

            May be I mistake but it’s look like we use that to get time in Unix format in case of broken timestamp not reverse.

           

            MO time stamp is correct all you need to format it as you want.

           

            Dima.

                       

 

-----Original Message-----
From: Angel Fradejas [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 14, 2002 8:29 PM
To: Kannel Developers
Subject: timestamps with emi2

 

I recently began to work with a EMI2 smsc link, and have a question about the calculation of the timestamps for the MO messges.

 

First, the code at smsc_emi2.c splits day,month,year, and so on, and then it takes the corresponding time_t by calling date_convert_universal.

 

The question is the timestamp I'm getting in the msg->sms.time variable is one month ahead the real one. For example for the EMI2 timestamp "140102185129" I get a timestamp representing "14/02/2002 18:51:29 UTC".

 

I think the problem is in de date.c function date_convert_universal:

 

    line 81:  date += monthstart[t->month] * DAY;

 

Shouldn't it be

 

    line 81:  date += monthstart[t->month-1] * DAY;

 

?

 

Or am I doing something wrong?

 

I need exacts timestamps because we have to do accounting fo the sms traffic.

 

Angel Fradejas.

 

Reply via email to