YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Get Timestamp point source Options · View
zfima
#1 Posted : Monday, November 21, 2011 3:07:55 PM
Rank: Advanced Member

Groups: Member

Joined: 11/13/2011
Posts: 77
Location: Middle East
hello to everyone!!! I face a problem with getting timestamp value from point of type typestamp

My code written in C#. I put here logical part of project:
Code:

Array arr = _mdbEvents.TakeAll();
foreach (PIEventObject piEventObj in arr)
{
    PointValue pv = (PointValue)piEventObj.EventData;

    if (pv.PIValue.Value.GetType().IsCOMObject)
    {
        if (pv.PIPoint.PointType == PointTypeConstants.pttypTimestamp)
        {
            //TODO pttypTimeStamp type not supported yet!
        }
        else
        {
            DigitalState digitalState = (DigitalState)pv.PIValue.Value;
            _pointValue = digitalState.Name;
        }

    }
    else
    {
        _pointValue = pv.PIValue.Value;
    }
}


In my code i can treat with all points value, except of timestamp type. I just can not get the value!!!!
If point is DigitalState, is OK, but if point of type timestamp and it not System digital set i have a problem!!!
Maybe someone could show me some way, please, to solve the problem.
I will very happy, if some one can help me.
Thanks!
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
zfima
#2 Posted : Monday, November 21, 2011 3:28:31 PM
Rank: Advanced Member

Groups: Member

Joined: 11/13/2011
Posts: 77
Location: Middle East
I find the answer here http://www.rjksolutionsl...a-timestamp-in-UTC.aspx

Just add next lines:
Code:
PITimeServer.PITime time = (PITimeServer.PITime)myValue.Value;
string dateTime = time.LocalDate.ToString();

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.