當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。