private void UpdateSPATSyncTime(string intersectionId) { if (SPATRequestSyncTimes.ContainsKey(intersectionId) == true) { SPATRequestSyncTimes[intersectionId] = DateTime.Now; } else { SPATRequestSyncTimes.Add(intersectionId, DateTime.Now); } }
private bool ShouldSyncSPATData(string intersectionId) { var valid = true; DateTime ofLastSync = DateTime.Now; if (SPATRequestSyncTimes.ContainsKey(intersectionId) == true) { ofLastSync = SPATRequestSyncTimes[intersectionId]; } else { ofLastSync = ofLastSync.AddSeconds(-11); } var secondsExpired = Math.Abs((DateTime.Now - ofLastSync).TotalSeconds); valid = secondsExpired > Constants.SPAT_MESSAGE_VALIDATION_PERIOD_SECONDS; return(valid); }