FOUNDATION Fieldbus

cancel
Showing results for 
Search instead for 
Did you mean: 

nifTrendData_t lastUpdate

I try to read the lastUpdate for the nifTrenData_t. What I get are two values (uint32 upper and unint32 lower). (I use printf %s to read lastUpdate.lower and %s lastUpdate.upper)

Can you guys show me how to read that value in the format mm/dd/yy hh:mm:ss.sss?

Thanks
0 Kudos
Message 1 of 5
(8,149 Views)
Hello,

Thank you for contacting National Instruments.

To answer your question, I will need a little more information. What programming language are you using? What hardware are you reading from? What does the nifTrenData_t function do?

Please reply with this information and I will be happy to help you out.

Regards,

Sean C.
Applictions Engineer
National Instruments
0 Kudos
Message 2 of 5
(8,147 Views)
C programming language.

I'm using NI-FBUS Communications Manager to read the trend object in fieldbus devices. The nifTrendData_t function is from the nifbus.h which comes with the NI Communication Manager.

Hope this is enough information for you.

Thanks
JN
0 Kudos
Message 3 of 5
(8,147 Views)
Hello,

The unit of time stamp for nifTrendData_t is 1/32 ms, and starting from Jan 1, 1972 according to FF specification. So it turns to be a very huge integer number to represent the time stamp value.

In this case, you'd better to use 64 bit integer (like _int64 in C) to represent this value. In fact, the upper part of nifTime_t stands for upper 32 bit section of this value, while the lower part of nifTime_t stands for lower 32 bit section of the value.

For example, when you get the "lastUpdate.upper" and "lastUpdate.lower" values from nifTrenData_t as following:

lastUpdate.upper = 0x00001e01; // 7681 in decimal
lastUpdate.lower = 0x73f800f1; // 1945633009 in decimal

Then the actual time value is:

timeInFFUnit = 0x00001e0173f800f1; // 329915894
33585 in decimal

Since the unit is 1/32 ms, you will get:

timeInMs = timeInFFUnit / 32 = 1030987169799 ms

Considering time stamp of 00:00:00, Jan 1, 1972 is 0, you will get:

Day = 11932; // it is Sep 1, 2004
Hour = 17;
Minute = 19;
Second = 29;
MilliSecond = 799;

So finally you will get the Time Stamp as:

09/01/04 17:19:29:799


Hope it helps.

S. G.
Fieldbus Support Engineer
National Instruments

Please contact us by sending e-mail to fieldbus.support@ni.com , which is the dedicated support e-mail address for NI Foundation Fieldbus products.
0 Kudos
Message 4 of 5
(8,147 Views)
Hello,

I apologize... I did not realize you were using FieldBus. All FieldBus questions should be directed to fieldbus.support@ni.com

Sincerely,

Sean C.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(8,148 Views)