I index files using a BackgroundWorker. When finished I want to display the time the process lasted. Even when indexing takes less then one minute I get a time like:
63754024013,3167 sec.
63754024013,3167 sec.
Code:
ReadOnly dtt As Date
Dim dtt As Date = Now
BackgroundWorker1.RunWorkerAsync()
Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
Dim StopTime As Date = Now
Dim ts As TimeSpan = StopTime - dtt
PictureLoading.Visible = False
ToolStripStatusLabel1.Text = "Finished indexing in " + DateTime.Now.Subtract(dtt).TotalSeconds.ToString + " sec."
End Sub