Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Ticks to calculate number of seconds with two deci
Message
De
04/04/2006 17:29:21
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
04/04/2006 15:45:12
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01110385
Message ID:
01110436
Vues:
10
>Is using Ticks the way to go to calculate the number of seconds with two decimals to obtain a processing time of an operation which normally executes within 0 to 2 seconds? I would like to obtain something like 0.32, 1.34, etc. Is the use of Date.Now.Ticks the approach to use?

Michel,

DateTimes have a 1-tick granularity, so they are good for timing stuff. The only thing that could negatively affect a simple DateTime based timer is that its thread may get interrupted between the last statement inside the timing block and the call to DateTime.Now.

If you really want a hardcore timer, you'd have to enclose the entire batch in a synclock.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform