Skip to content

Commit

Permalink
Update hightime library
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneDroid committed Apr 5, 2024
1 parent 5a8c6a5 commit 30368e6
Show file tree
Hide file tree
Showing 5 changed files with 878 additions and 940 deletions.
4 changes: 3 additions & 1 deletion generated/nidaqmx/_lib_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ class AbsoluteTime(ctypes.Structure):

@classmethod
def from_datetime(cls, dt: Union[std_datetime, ht_datetime]) -> AbsoluteTime:
seconds_since_1904 = int((dt - AbsoluteTime._EPOCH_1904).total_seconds())
seconds_since_1904 = 0

# Convert the subseconds.
if isinstance(dt, ht_datetime):
seconds_since_1904 = int((dt - AbsoluteTime._EPOCH_1904).precision_total_seconds())
total_yoctoseconds = dt.yoctosecond
total_yoctoseconds += dt.femtosecond * AbsoluteTime._YS_PER_FS
total_yoctoseconds += dt.microsecond * AbsoluteTime._YS_PER_US
lsb = int(
round(AbsoluteTime._NUM_SUBSECONDS * total_yoctoseconds / AbsoluteTime._YS_PER_S)
)
else:
seconds_since_1904 = int((dt - AbsoluteTime._EPOCH_1904).total_seconds())
lsb = int(
round(AbsoluteTime._NUM_SUBSECONDS * dt.microsecond / AbsoluteTime._US_PER_S)
)
Expand Down
Loading

0 comments on commit 30368e6

Please sign in to comment.