当前位置: 首页>>代码示例>>C#>>正文


C# TimeSpan.Samples方法代码示例

本文整理汇总了C#中System.TimeSpan.Samples方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSpan.Samples方法的具体用法?C# TimeSpan.Samples怎么用?C# TimeSpan.Samples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.TimeSpan的用法示例。


在下文中一共展示了TimeSpan.Samples方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PullOutputData

        public override IOutputData PullOutputData(IDAQOutputStream stream, TimeSpan duration)
        {
            /*
             * IOuputData will be directed to a device (not an DAQStream) by the controller.
             * Controller should get mapping (device=>data) from the current Epoch instance.
             *
             * Thus the standard PullOuputData will pull from the controller's queue for this
             * device.
             */

            if (duration.Samples(stream.SampleRate) <= 1)
                throw new ExternalDeviceException("Cannot pull less than one sample.");

            try
            {
                IOutputData data = this.Controller.PullOutputData(this, duration);

                return data.DataWithUnits(MeasurementConversionTarget)
                    .DataWithExternalDeviceConfiguration(this, Configuration);
            }
            catch (Exception ex)
            {
                log.DebugFormat("Error pulling data from controller: " + ex.Message);
                throw;
            }
        }
开发者ID:physion,项目名称:symphony-core,代码行数:26,代码来源:ExternalDevice.cs

示例2: DataForDuration

        private static IOutputData DataForDuration(TimeSpan blockDuration, IMeasurement sampleRate)
        {
            ulong nSamples = blockDuration.Samples(sampleRate);

            var samples = Enumerable.Range(0, (int)nSamples).Select(i => new Measurement(1, "V")).ToList();

            return new OutputData(samples, sampleRate, false);
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:8,代码来源:HekaIntegration.cs

示例3: ConstantMeasurementList

 private static IEnumerable<IMeasurement> ConstantMeasurementList(TimeSpan blockDuration, IMeasurement srate, IMeasurement value)
 {
     //log.DebugFormat("Generating constant measurment: {0} x {1} samles @ {2}", value, blockDuration.Samples(srate), srate);
     return Enumerable.Range(0, (int)blockDuration.Samples(srate))
         .Select(i => value)
         .ToList();
 }
开发者ID:physion,项目名称:symphony-core,代码行数:7,代码来源:Epoch.cs

示例4: PullsOutputData

        public void PullsOutputData()
        {
            var dur1 = new TimeSpan(seqData.Duration.Ticks / 3);
            var pull1 = seqStream.PullOutputData(dur1);

            var dur2 = new TimeSpan(seqData.Duration.Ticks);
            var pull2 = seqStream.PullOutputData(dur2);

            var samples1 = (int)dur1.Samples(seqStream.SampleRate);
            Assert.That(pull1.Data, Is.EqualTo(seqData.Data.Take(samples1).ToList()));

            var samples2 = (int)dur2.Samples(seqStream.SampleRate);
            Assert.That(pull2.Data, Is.EqualTo(seqData.Data.Skip(samples1).Take(samples2).ToList()));
        }
开发者ID:Symphony-DAS,项目名称:symphony-core,代码行数:14,代码来源:IODataStreamTests.cs


注:本文中的System.TimeSpan.Samples方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。