C# DateTime.Now - unexpected imprecise, unexpected digits

Viewed 62

I would like to present a phenomenon that I have noticed, which I will show on a very simple code with a for loop passed to a richtextbox.

void Button1Click(object sender, EventArgs e)
{
    for (int i = 0; i< 1000; i++){
        richTextBox1.AppendText (DateTime.Now.ToString("HH:mm:ss.ffffff") + "\n");
    }
}

After clicking a button I see something like this (a part of the result):

...
12:55:43.496086
12:55:43.496086
12:55:43.496086
12:55:43.496086
12:55:43.496086
12:55:43.496086
12:55:43.496086
12:55:43.511728
12:55:43.511728
12:55:43.511728
12:55:43.511728
12:55:43.511728
12:55:43.511728
...

Some data stamps are the same - trouble with the resolution, but... where do the values ​​of the last digits come from? How to effectively improve the resolution to microseconds?

0 Answers
Related