TDateTime::CurrentDateTime - problem with accurate time in milliseconds
I'm makeing a log where I need a timestamp for each log. The problem is the accuracy of the milliseconds when I request consecutive timestamps. In my log, when requesting a new timestamp within 100ms, it seems that TDateTime::CurrentDateTime jumps 10ms instead of 1ms. A piece of my selfmade log is shown below. As you se least significant millisecond digit is 3, and the change occures from the is the second least significant millisecond digit.
I call the function AddEvent (code snipp attached) from a multithreaded environment by using TThread::Synchronize.
Do any one know the cause of this? And if so, is there a way to get 1ms accuracy of the timestamp?
If it is just dumping it into an array which is picked up by a logger task you might get more accurate timings.