cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Retrieving the X Y position of a tag at a particular time

50
Views
0
Helpful
0
Comments
This document was generated from CDN thread

Created by: chiranjeevi vardhineni on 19-04-2010 04:53:32 AM
Hi
 
  We need to get the tag data ie the x and y position at a particulat time.
 
For eg: what is the data within the tag (x and y) at April  1 st 2010 08:15 AM
 
Can yuu please specify the API and howw to use this.
You have said the time format is in long how to convert this or is it specifies the ticks of the time. We are using dotnet
 
Thanks

Subject: RE: Retrieving the X Y position of a tag at a particular time
Replied by: Matt Denapoli on 19-04-2010 09:50:05 PM
Hi Chiranjeevi,

You will want to use the GetTagHistoryListByArgs and set the fromTimeMillis and toTimeMillis. 

I believe the conversion is as such:

Java(Date) = 1000 * C(Date)

So, you¿ll want to convert your C# datetime to a long:

DateTime dateTime = ....
long number = Convert.ToInt64( dateTime );
or
long number = dateTime.Ticks;

And then multiply by 1000.  To convert back, make sure to divide by 1000.

Regards,

Matt

Subject: RE: Retrieving the X Y position of a tag at a particular time
Replied by: Matt Denapoli on 20-04-2010 01:38:36 PM
Here's code provided by Raghavendra in another post:
 
public static DateTime UnixTimeStampToDateTime( double unixTimeStamp )
{
//
Unix timestamp is seconds past epoch
System.DateTime dtDateTime =
new DateTime(1970,1,1,0,0,0,0);
dtDateTime = dtDateTime.AddSeconds(
unixTimeStamp ).ToLocalTime();
return  dtDateTime;
}

public
static DateTime JavaTimeStampToDateTime(double  javaTimeStamp)
{
//
Java timestamp is millisecods past epoch
System.DateTime dtDateTime =
new DateTime(1970,1,1,0,0,0,0);
dtDateTime =
dtDateTime.AddSeconds(Math.Round(javaTimeStamp / 1000)).ToLocalTime();
return 
dtDateTime;
}
 
Matt
Content for Community-Ad
Cisco Community August2020 Spotlight Award Winners
This widget could not be displayed.