ni / nidaqmx-python

A Python API for interacting with NI-DAQmx
Other
443 stars 157 forks source link

Update libtime to accept time before 1970 #504

Closed DeborahOoi96 closed 8 months ago

DeborahOoi96 commented 8 months ago

What does this Pull Request accomplish?

Modify _lib_time.py and _grpc_time.py to accept time before 1970. Add unit test coverage to test for times before 1904 and on 1904.

Why should this Pull Request be merged?

Adding a component test for cfg_time_start_trig uncovered the fact that @zhindes's time conversion functions don't work with dates before 1970 because they rely on POSIX timestamps. We want to fix this aspect of the time conversion functions and simplify them to make better use of the hightime library. We also want to add enough coverage to validate that the problem is entirely fixed. For example, AbsoluteTime.from_datetime still uses datetime.timestamp(), which uses POSIX time.

What testing has been done?

Built successfully. All test passed including newly added tests image

DeborahOoi96 commented 8 months ago

tzlocal dependency added in #521. All tests passes on my local machine.