[OpenSIPS-Users] Getting Wrong Time Stamp from $Tsm

Dipteshkumar Patel diptesh.patel at ecosmob.com
Tue Nov 14 09:47:47 EST 2017


hello all,

I got the option to get right time stamp both in seconds and microseconds
and that is
get_timestamp(sec_avp,usec_avp);
which uses gettimeofday() system call internally.

refer following link
https://www.opensips.org/Documentation/Script-CoreFunctions-2-3

*Diptesh Patel*
Jr. Software Developer
Ecosmob Technologies Ltd
Ahmedabad
Mo:*+919898962659*

On Wed, Nov 1, 2017 at 3:59 PM, Bogdan-Andrei Iancu <bogdan at opensips.org>
wrote:

> Hi Diptesh,
>
> Unfortunately the docs are a bit misleading - the supported format for the
> $time() var is given by "man strftime" - and strftime has no support for
> time units smaller than the second. This is why the %N is not evaluated.
>
> Regards,
>
> Bogdan-Andrei Iancu
>   OpenSIPS Founder and Developer
>   http://www.opensips-solutions.com
>
> On 10/31/2017 03:32 PM, Dipteshkumar Patel wrote:
>
> Hello sir,
>
> Thanks for your prompt reply
>
> I used *$time(+%s%N)* but it uses only one format and give the result "
> *+1509451841%N*" but i want to whole time stamp.
>
> This works fine from command line using  *#time +%s%N.*
>
>
>
>
> *Diptesh Patel*
> Jr. Software Developer
> Ecosmob Technologies Ltd
> Ahmedabad
> Mo:*+919898962659*
>
> On Tue, Oct 31, 2017 at 5:12 PM, Bogdan-Andrei Iancu <bogdan at opensips.org>
> wrote:
>
>> Hi,
>>
>> Have you looked at the $time(format) script variable:
>>
>> http://www.opensips.org/Documentation/Script-CoreVar-2-3#toc87
>>
>> You can take the all the time fields at once, and use a transformation to
>> split them if you need the fields in separate variables.
>>
>> Regards,
>>
>> Bogdan-Andrei Iancu
>>   OpenSIPS Founder and Developer
>>   http://www.opensips-solutions.com
>>
>> On 10/31/2017 10:36 AM, Dipteshkumar Patel wrote:
>>
>> Dear sir,
>>
>> I am using Opensips version 2.3.1
>>
>> I am using $Ts and $Tsm for time stamp for CDR but the microsecond time
>> stamp is not same as system time stamp. To resolve the issue i am using
>> exec() to get the system time but i takes so much time (nearly 5ms )
>> whenever so many calls concurrently running on server(We need exact time
>> because it will affect the call duration).
>>
>> Can you please suggest me solution for the issue ?
>>
>> Thanks
>>
>> *Diptesh Patel*
>> Jr. Software Developer
>> Ecosmob Technologies Ltd
>> Ahmedabad
>> Mo:*+919898962659*
>>
>>
>> _______________________________________________
>> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171114/1d0ca21c/attachment.html>


More information about the Users mailing list