mirror of
https://github.com/SDRSharpR/SDRSharper.git
synced 2025-12-06 04:12:02 +01:00
27 lines
404 B
C#
27 lines
404 B
C#
using System.Diagnostics;
|
|
|
|
namespace SDRSharp.Radio
|
|
{
|
|
public class Counter : Stopwatch
|
|
{
|
|
private int _count;
|
|
|
|
public long Elaps(int init)
|
|
{
|
|
if (--this._count > 0)
|
|
{
|
|
return 0L;
|
|
}
|
|
if (init != 0)
|
|
{
|
|
base.Stop();
|
|
}
|
|
long elapsedMilliseconds = base.ElapsedMilliseconds;
|
|
this._count = init;
|
|
base.Reset();
|
|
base.Start();
|
|
return elapsedMilliseconds / init;
|
|
}
|
|
}
|
|
}
|