How to convert milliseconds to seconds.?

Do I need to convert the "Variable" stopwatch into seconds?

Stopwatch czasAlg = new Stopwatch(); czasAlg.Start(); //Do semothing czasAlg.Stop(); Decimal Tn = czasAlg.ElapsedMilliseconds/(decimal)n; 
+6
c # stopwatch
source share
7 answers

Divide by 1000 or use

 czasAlg.Elapsed.TotalSeconds 
+22
source share

Just to be different:

Multiply by 0.001.

+15
source share

Without own constants and magic numbers:

 TimeSpan.FromMilliseconds(x).TotalSeconds 
+10
source share

Using

 czasAlg.Elapsed.TotalSeconds 
+5
source share
+2
source share

Divide by 1000.0?

0
source share

Divide by 1000.

0
source share

All Articles