本文整理汇总了C#中Ticks.DistanceBeyondSecond方法的典型用法代码示例。如果您正苦于以下问题:C# Ticks.DistanceBeyondSecond方法的具体用法?C# Ticks.DistanceBeyondSecond怎么用?C# Ticks.DistanceBeyondSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticks
的用法示例。
在下文中一共展示了Ticks.DistanceBeyondSecond方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNewFrame
/// <summary>
/// Creates a new BPA PDCstream specific <see cref="DataFrame"/> for the given <paramref name="timestamp"/>.
/// </summary>
/// <param name="timestamp">Timestamp for new <see cref="IFrame"/> in <see cref="Ticks"/>.</param>
/// <returns>New BPA PDCstream <see cref="DataFrame"/> at given <paramref name="timestamp"/>.</returns>
/// <remarks>
/// Note that the <see cref="ConcentratorBase"/> class (which the <see cref="ActionAdapterBase"/> is derived from)
/// is designed to sort <see cref="IMeasurement"/> implementations into an <see cref="IFrame"/> which represents
/// a collection of measurements at a given timestamp. The <c>CreateNewFrame</c> method allows consumers to create
/// their own <see cref="IFrame"/> implementations, in our case this will be a BPA PDCstream data frame.
/// </remarks>
protected override IFrame CreateNewFrame(Ticks timestamp)
{
// We create a new BPA PDCstream data frame based on current configuration frame
ushort sampleNumber = (ushort)((timestamp.DistanceBeyondSecond() + 1.0D) / base.TicksPerFrame);
DataFrame dataFrame = new DataFrame(timestamp, m_configurationFrame, 1, sampleNumber);
DataCell dataCell;
foreach (ConfigurationCell configurationCell in m_configurationFrame.Cells)
{
// Create a new BPA PDCstream data cell (i.e., a PMU entry for this frame)
dataCell = new DataCell(dataFrame, configurationCell, true);
// Add data cell to the frame
dataFrame.Cells.Add(dataCell);
}
return dataFrame;
}
示例2: GetNTPTimestampFromTicks
protected static ulong GetNTPTimestampFromTicks(Ticks timestamp)
{
timestamp -= GetBaseDateOffsetTicks(timestamp);
uint seconds = (uint)Math.Truncate(timestamp.ToSeconds());
uint fraction = (uint)(timestamp.DistanceBeyondSecond().ToSeconds() * uint.MaxValue);
return Word.MakeQword(seconds, fraction);
}