I am using a transaction group to capture some timestamps in the new Logix DT datatype form a ControlLogix PLC running version 35 firmware. The data posted to the database is all rounded to the nearest second. The transaction group is configured to use the DateTime data type for these values. Is this the expected behaviour? The database shows 0 ms values for all the tags, for example: 2023-06-30 14:34:31.000.
It looks like I can switch the transaction group to Long type, which for some reason rounds off to the millisecond rather than the microseconds in the PLC. This is OK for this application, but I would prefer to stay in DateTime of there is a way to make that work.
I am running Ignition version 8.1.28.
What flavor of database, and what data type is the column set to?
Yeah, the database flavor matters for the default precision of datetime data types. PostgreSQL defaults to three decimal places but can go to six decimals. IIRC, MariaDB defaults to zero decimal places. Not sure about MS SQL Server.
You might want to try my alternate driver. I tried hard to preserve microseconds all the way through the stack.
In typical Microsoft fashion it's complicated and stupid.
Precision is milliseconds but it's rounded to .000, .003, or .007(?) seconds for DateTime
DateTime2 is better, it has a precision of 7 digits with an accuracy of 100ns.
The Logix Driver preserves them all the way as well.
But neither of our drivers can overcome the fact that once it hits the Ignition tag system it becomes a Java Date, which only has millisecond precision.
Ah, forgot that quirk. When I need microseconds, I'm usually using direct access in my Class 1 driver's scripting feature.
Some day we should introduce a
DateTime2 tag datatype that is based on
It is a MySQL database, and the column datatype is datetime, so it should be able to support all the way down to microseconds.
Is it maybe being truncated when ignition reads it into it's own datetime type?
I appreciate all the replies here, this forum is excellent!
That's not enough information. Is the column type
datetime(6), or something else?
They were datetime(0). I changed them over to datetime(6) and now I am getting my milliseconds as I would expect.
For some reason my brain named you Paul, and I have no idea why? Sorry about that ¯\(ツ)/¯
It's not the first time Phil and I have been confused for each other (digitally, at least )