Open UnityAnthony opened 2 years ago
Hi Anthony, we already report usages of DateTime.Now. I wonder if we should warn about any DateTime usage. What do you think?
I would flag any use of Datetime but not as critical, the DateTime.Now should be the critical issue to address
On Mon, Jul 25, 2022, 10:50 AM Marco Trivellato @.***> wrote:
Hi Anthony, we already report usages of DateTime.Now https://docs.microsoft.com/en-us/dotnet/api/system.datetime.now. I wonder if we should warn about any DateTime usage. What do you think?
— Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/ProjectAuditor/issues/78#issuecomment-1194151514, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFHUYCVDDV4VHIBKCXILL3VV2SS7ANCNFSM5N6LM2DQ . You are receiving this because you authored the thread.Message ID: @.***>
Problem statement Usually when people use DateTime it is because it is convenient for comparison of two time stamps to get the delta in seconds. This is a slow way to get this data.
Proposed solution When DateTime is used to get a seconds delta use StopWatch. It is very fast and precise.