could you please fix this bug? Here is a Little description:
The problem is in s7_micro_client.cpp in the method FillTime which you used in GetPgBlockInfo and opAgBlockInfo.
You use in your FillTime only the day value, but if you use both, the day and the MS value it will be correct. I tried this in c# and here is my codesnippet about this test:
var dt = new DateTime(1984, 1, 1, 0, 0, 0, 0);
dt = dt.AddMilliseconds(ms); // this is the ResData->CodeTime_ms value
dt = dt.AddDays(dy); // this is the ResData->CodeTime_dy value
Now in dt is the correct date and time.
Best regards
Benji
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The TS7BlockInfo struct contains 11 chars as CodeDate and IntfDate which are encoded as text.
Adding the time info would break the compatibility with all previous releases and this would be justified only if many people so requires.
Sorry, but you're the only one who suffers from this problem.
Thanks for reporting anyway...
Regards
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the c++ version of the library -> added two new fields, char CodeDateTime[25]; and char IntfDateTime[25];, to the structs TS7BlockInfo and PS7BlockInfo.
Added a helper function TSnap7MicroClient::FillDateTime(word SiemensDay, u_int SiemensMs, char *PTime) to fill the full timestamp information of the memory blocks to the newly added fields CodeDateTime and IntfDateTime.
The timestamps in blockinfo are only dates, but it should be date and time.
Hi once again,
could you please fix this bug? Here is a Little description:
The problem is in s7_micro_client.cpp in the method FillTime which you used in GetPgBlockInfo and opAgBlockInfo.
You use in your FillTime only the day value, but if you use both, the day and the MS value it will be correct. I tried this in c# and here is my codesnippet about this test:
Now in dt is the correct date and time.
Best regards
Benji
Benji,
Did you manage to fix this at all? I guess this was almost 5 years ago so you have probably moved on since then! :)
Thanks,
Marco
Hi,
this is not a bug but a choice.
The TS7BlockInfo struct contains 11 chars as CodeDate and IntfDate which are encoded as text.
Adding the time info would break the compatibility with all previous releases and this would be justified only if many people so requires.
Sorry, but you're the only one who suffers from this problem.
Thanks for reporting anyway...
Regards
Dave
Hi Davide,
I am also curious about this - is there no possible way without changing the core files?
All the best,
Marco
Dear @Davide Nardella,
I have fixed this issue in the C++ part of the source code.
Changes related to the fix : https://github.com/Securenok/snap7/pull/2
char CodeDateTime[25];
andchar IntfDateTime[25];
, to the structsTS7BlockInfo
andPS7BlockInfo
.TSnap7MicroClient::FillDateTime(word SiemensDay, u_int SiemensMs, char *PTime)
to fill the full timestamp information of the memory blocks to the newly added fieldsCodeDateTime
andIntfDateTime
.The fixed version is made available for public use : https://github.com/Securenok/snap7
Kindly let me know if you find any issues with the above mentioned changes.
Thanks & regards,
Anand
Last edit: Anandhakumar Palanisamy 2025-06-13