NxTime Usage
The struct NxTime is a member of 3 structures in NxCoreAPI:
NxCore 1.x (.nxc files) do NOT contain 1 millisecond resolution for either NxCore normalized or exchange timestamps.
NxCore 2.x (.nx2 files) include exchange timestamps to 1 millisecond resolution with the NxCore normalized clock remaining at 25ms.
NxTime
NxTime is defined in NxCoreAPI.h as:
struct NxTime {
unsigned int MsOfDay;
unsigned short Millisecond;
unsigned char Hour;
unsigned char Minute;
unsigned char Second;
char TimeZone;
unsigned short MsResolution;
unsigned char alignment[4];
};
NxTime members
| Member | Type | Min | Max | Description |
|---|---|---|---|---|
| MsOfDay | unsigned long |
0 | 86,400,000 | MsOfDay represents the total number of milliseconds from the start of the day. It will always equal NxTime.Hour*3600000 + NxTime.Minute*60000 + NxTime.Second*1000 + NxTime.Millisecond. |
| Millisecond | unsigned short |
0 | 1,000 | Millisecond represents the millisecond of the current second. It will be zero if the MsResolution member is 1000 or higher. |
| Hour | unsigned char |
0 | 23 | Hour represents current hour of the day in military format (0-23). For example: at 9am, the Hour would be 9, at 12:15am, the hour would be 0, at 12:15pm, the hour would be 12. |
| Minute | unsigned char |
0 | 59 | Minute represents current minute of the hour. At 9:00am, minute would be 0. At 9:59am, minute would be 59. |
| Second | unsigned char |
0 | 59 | Second represents current second of the minute. At 9:00:00 second would be 0. At 9:59:59 second would be 59. |
| TimeZone | char | -23 | +23 | TimeZone represents the number of whole hours from GMT. All NxTime structures use Eastern EDT during Daylight Savings Time (March - November), making TimeZone -4, and Eastern Standard time the rest of the year making TimeZone -5. |
| MsResolution | unsigned short |
0 | 1000 | MsResolution defines the current lowest resolution of the clock in Milliseconds. That is, the shortest possible time between updates. NxClock is currently set to 1 representing 1 milliseconds between clock updates. |
| alignment | unsigned char |
0 | 0 | This member pads the struct for correct alignment |