Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Low
-
Resolution: Complete
-
Affects Version/s: 7.1.0
-
Fix Version/s: 7.1.2
-
Component/s: None
-
Labels:None
-
Story Points:1
-
Severity:Trivial
-
Fixed in Build:7.1.2.223
-
Documentation Required:Completed
-
Requires More Info:Requires More Info
-
Epic Link:
-
Sprint:Sprint 1, Sprint 2, Sprint 3
Description
Many parts of the code call these two methods very frequently:
SystemDateTime.GetCurrentTimeUtc()SystemDateTime.GetCurrentTimeUtc()
These are performance degradation and would be very helpful to cache these calls for 5 to 10 minutes to save these calls.
I worked on a code for this but didn't apply it- here is the snippet
private static DateTime _nextUtcUpdate = DateTime.MinValue; private static TimeSpan _driftUtcNow = TimeSpan.Zero; public static DateTime GetCurrentDbTimeUtc() { DateTime utcNow; if ((utcNow = DateTime.UtcNow) > _nextUtcUpdate) { _driftUtcNow = utcNow - SystemDateTime.GetCurrentTimeUtc(); _nextUtcUpdate = utcNow.AddMinutes(20); } return utcNow + _driftUtcNow; }