I use a graphic control with the absolute time format on the X axis.
But this has a big limitation. The date can only reach 2035.
In order not to have this limit in working with dates I use the National Instruments Binary Time Format.
The problem returns when working with the graphs because using the CVIAbsoluteTimeToCVIUILTime to set the X axis the limit to 2035 is again present.
Is there a solution to avoid this problem?
Thanks in advance for your help,
This appears to be a problem of the native time format in the graph control, which relies on MakeDateTime and inherits its limitations.
The graph control however can display any quantity that can be expressed in double numbers, and time indeed can be and well past year 2035, so while you wait for NI to update CVI to address this problem you could solve it with a bit of effort on your side.
I made a quick and dirty example that shows this solution: you can input any date you want and it will format a 10-days graph axis.
Note 1: this example only works in 64-bit mode
Note 2: there is no control on day/month/year overflow in 10-days calculation: did I mention it is a quick-and-dirty code? 😉
Thanks for your timely help.
The only problem is that my application has to be compiled to 32bit due to some LIBs.
I thought of a workaround using the NI-BTF functions to get the number of seconds from 1/1/1900 into a 64-bit integer.
CVIAbsoluteTime absTimeStart, absTime2;
// Convert to absolute time
CVIAbsoluteTimeFromLocalCalendar((unsigned int) year, (unsigned int) month, (unsigned int) day, (unsigned int) 14, (unsigned int) 30, (unsigned int) 30, 0.0, &absTimeStart);
CVIAbsoluteTimeFromLocalCalendar((unsigned int) 1900, (unsigned int) 1, (unsigned int) 1, (unsigned int) 0, (unsigned int) 0, (unsigned int) 0, 0.0, &absTime2);
SubtractCVIAbsoluteTimes(absTimeStart, absTime2, &timeInterval);
// Convert to int64
CVITimeIntervalToTimeUnit(timeInterval, CVITimeUnitSeconds, CVITimeRoundMethodUp, &start);
The variable 'start' corresponds to the one calculated with mktime in your example.
In your opinion can it be a valid solution?
Grazie del tuo aiuto 😉