1 Reply Latest reply on Aug 24, 2017 12:50 PM by Rick Davin

    What is the equivalent of pitm_systime in PI AF SDK?


      What is the equivalent of pitm_systime in PI AF SDK?

        • Re: What is the equivalent of pitm_systime in PI AF SDK?
          Rick Davin

          Hi Naveen,


          I have a feeling you are going to ask a lot of questions like this.  My best advice is not to try a line-by-line translation of code but to review a block of PI API code and sketch out what it is doing.  Then follow that sketch to recreate in AF SDK.  If you need some training in AF SDK, here is a link to our small, private online course (SPOC) called Developing Applications with PI AF SDK.


          To do your translation justice, you must also understand that there are many times no direct equivalency.


          For this particular question, I went to techsupport.osisoft.com and searched on pitm_systime.  Filter the hits by Documentation:


          2017-08-24 07_39_06-Search_ pitm_systime.png


          Near the top, this link looked promising.  You will see from the documentation that an Int32 is returned.  This represents number of seconds, but not necessarily from midnight Jan 1, 1970 UTC because there is no time zone information carried with the Int32.  You just assume the value is in your local time.


          Then you can go to Live Library HELP for PI AF SDK.  The first page has a link for Time Hierarchy.  You will want to study up on AFTime.  Note AFTime is not an Int32, but based on .NET's DateTime.  Internally the AFTime tracks by UtcSeconds and can output in AFTime.UtcTime or AFTime.LocalTime.  This is slightly different that DateTime, which has a Kind property denoting Utc, Local, or Unspecified.  AFTime abhors Unspecified.  Useful other AFTime properties are AFTime.Now and AFTime.MinValue (for Jan 1, 1970).


          2 of 2 people found this helpful