Nanoseconds not being written correctly to DB (last few digits get changed) #489
Description
In the write_points function with json protocol and time_precision = 'n'.
There is a line in the code (line # 217 in version 4.1.1 - see snippet below ) that basically takes a datetime value and divided it by 1. However the division is done using float (/) versus integer division (//). This changes the last few digits of the datetime being written. E.g. it the value 1502114400290050489 when divided by 1 using / changes to 1.5021144002900506e+18. When using // and dividing by 1 it remains unchanged.
------------CODE COPY BELOW------------------------------------
points = [
{'measurement': measurement,
'tags': dict(list(tag.items()) + list(tags.items())),
'fields': rec,
'time': int(ts.value / precision_factor)}
for ts, tag, rec in zip(dataframe.index,
dataframe[tag_columns].to_dict('record'),
dataframe[field_columns].to_dict('record'))