コード例 #1
0
        public AggregatedDataRange GetDataRange(string sourceName, int aggregationSeconds, [FromQuery] DateTime minTimeUtc, [FromQuery] DateTime maxTimeUtc)
        {
            var timeRange = new TimeRange(minTimeUtc.SecondsSince1970Utc(), maxTimeUtc.SecondsSince1970Utc());
            var data      = _generator.GenerateRange(sourceName, timeRange, aggregationSeconds);
            var now       = DateTime.UtcNow.SecondsSince1970Utc();

            if (data.TimeRange.Min >= now)
            {
                return(new AggregatedDataRange(timeRange, new List <double>(), aggregationSeconds));
            }
            var filteredData = _aggregatedFilterer.FilterDataRange(data, new TimeRange(data.TimeRange.Min, now));

            return(new AggregatedDataRange(timeRange, filteredData.Data, aggregationSeconds));
        }