The $TV(Sn) returns a string containing the seconds and milliseconds. To get the current DateTime I have to add the seconds since standard epoch. What about the milliseconds? Are those the current milliseconds?
I'm using the following C# code to create a DateTime object using the value from $TV(Sn):
Is this correct?
string[] timestampParts = timestamp.Split('.'); int seconds = Convert.ToInt32(timestampParts[0]); int milliseconds = Convert.ToInt32(timestampParts[1].Substring(0, 3)); DateTime returnDate = new DateTime(1970, 1, 1, 0, 0, 0, milliseconds).AddSeconds(seconds).ToLocalTime();
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Andrew Pogrebennyk Sent: Wednesday, October 22, 2014 2:02 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Unix timestamp with millisecond precision
See http://www.kamailio.org/wiki/cookbooks/4.2.x/pseudovariables#tv_name
On 10/22/2014 10:40 AM, Grant Bagdasarian wrote:
Hello,
I'm currently using the $TS psuedovariable to get the current unix timestamp, but this only returns the timestamp up to a second precision.
Is it possible in kamailio to get the current unix timestamp with milliseconds precision?
Regards,
Grant
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users