Ejemplo n.º 1
0
        /// <summary>
        /// 查找N秒前的缓存数据,缓存时间不能超过历史时刻:HistoryTime
        /// </summary>
        /// <param name="carSensorSet"></param>
        /// <param name="historyTime">历史时刻:HistoryTime</param>
        /// <param name="seconds">N秒前数据</param>
        /// <returns></returns>
        public static CarSignalInfo[] QueryCachedSeconds(this ICarSignalSet carSensorSet, DateTime historyTime, double seconds)
        {
            var cachedDateTime = DateTime.Now.AddSeconds(-seconds);
            var time           = cachedDateTime < historyTime ? historyTime : cachedDateTime;

            return(carSensorSet.Query(time));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查找N秒前的缓存数据
        /// </summary>
        /// <param name="carSensorSet"></param>
        /// <param name="seconds"></param>
        /// <returns></returns>
        public static CarSignalInfo[] QueryCachedSeconds(this ICarSignalSet carSensorSet, double seconds)
        {
            var cachedDateTime = DateTime.Now.AddSeconds(-seconds);

            return(carSensorSet.Query(cachedDateTime));
        }