本文整理汇总了C#中System.Clock类的典型用法代码示例。如果您正苦于以下问题:C# Clock类的具体用法?C# Clock怎么用?C# Clock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Clock类属于System命名空间,在下文中一共展示了Clock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
IClock myclock = new Clock();
var todaySalutation = new TodaySalutation(myclock);
Console.WriteLine(todaySalutation.Salutation());
Console.ReadKey();
}
示例2: NormalSurface
internal NormalRunoff runoff; //let derived PondSurface see this but not outside world.
#endregion Fields
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="NormalSurface"/> class.
/// </summary>
/// <param name="SoilObject">The soil object.</param>
/// <param name="Clock">The clock.</param>
public NormalSurface(SoilWaterSoil SoilObject, Clock Clock)
{
SurfaceType = Surfaces.NormalSurface;
base.constants = SoilObject.Constants;
runoff = new NormalRunoff(SoilObject); //Soil is needed to initialise the cn2bare, etc.
evap = new NormalEvaporation(SoilObject, Clock);
}
示例3: InvocationQueue
public InvocationQueue(Clock clock, string instanceName, CloudBlobContainer archiveContainer, SqlConnectionStringBuilder connectionString)
: this()
{
_clock = clock;
_archiveContainer = archiveContainer;
InstanceName = instanceName;
_connectionString = connectionString;
}
示例4: PacMans
public PacMans(Texture2D texture, Vector2 pos)
: base(texture, pos)
{
this.Pos = pos;
this.texture = texture;
texEffects = SpriteEffects.None;
clock = new Clock();
}
示例5: JobRunner
public JobRunner(JobDispatcher dispatcher, InvocationQueue queue, ConfigurationHub config, Clock clock, CloudBlobContainer logContainer)
: this(config.GetSection<WorkConfiguration>().PollInterval)
{
Dispatcher = dispatcher;
Queue = queue;
Clock = clock;
_logContainer = logContainer;
}
示例6: CanCreateClock
public void CanCreateClock()
{
var expected = 27;
var clock = new Clock(expected);
Assert.AreEqual(expected, clock.Queue.Count());
Assert.AreEqual(1, clock.Queue.First());
Assert.AreEqual(27, clock.Queue.Last());
}
示例7: Run_All
/// <summary>
/// Runs all tests 27-127
/// </summary>
//[TestCase]
public void Run_All()
{
for (int i = 27; i <= 127; i++)
{
var clock = new Clock(i);
var result = clock.Start();
Assert.IsTrue(result.StartsWith(i.ToString()));
}
}
示例8: ClockView
public ClockView(IntPtr handle)
: base(handle)
{
_clock = new Clock ();
_timer = NSTimer.CreateRepeatingScheduledTimer (1, delegate {
SetNeedsDisplayInRect (Bounds);
});
}
示例9: Pengo
public Pengo(Texture2D texture, Vector2 pos)
: base(texture, pos)
{
clock = new Clock();
speed = new Vector2(1, 1);
windowY = Game1.TILE_SIZE * 15;
hitbox = new Rectangle((int)pos.X, (int)pos.Y, Game1.TILE_SIZE, Game1.TILE_SIZE);
texData = new Color[texture.Width * texture.Height];
texture.GetData(texData);
}
示例10: PhiAccrualFailureDetector
/// <summary>
/// Procedural constructor for PhiAccrualDetector
/// </summary>
/// <param name="threshold">A low threshold is prone to generate many wrong suspicions but ensures a quick detection in the event
/// of a real crash. Conversely, a high threshold generates fewer mistakes but needs more time to detect actual crashes</param>
/// <param name="maxSampleSize">Number of samples to use for calculation of mean and standard deviation of inter-arrival times.</param>
/// <param name="minStdDeviation">Minimum standard deviation to use for the normal distribution used when calculating phi.
/// Too low standard deviation might result in too much sensitivity for sudden, but normal, deviations
/// in heartbeat inter arrival times.</param>
/// <param name="acceptableHeartbeatPause">Duration corresponding to number of potentially lost/delayed
/// heartbeats that will be accepted before considering it to be an anomaly.
/// This margin is important to be able to survive sudden, occasional, pauses in heartbeat
/// arrivals, due to for example garbage collect or network drop.</param>
/// <param name="firstHeartbeatEstimate">Bootstrap the stats with heartbeats that corresponds to
/// to this duration, with a with rather high standard deviation (since environment is unknown
/// in the beginning)</param>
/// <param name="clock">The clock, returning current time in milliseconds, but can be faked for testing
/// purposes. It is only used for measuring intervals (duration).</param>
public PhiAccrualFailureDetector(double threshold, int maxSampleSize, TimeSpan minStdDeviation, TimeSpan acceptableHeartbeatPause, TimeSpan firstHeartbeatEstimate, Clock clock = null)
: this(clock)
{
_threshold = threshold;
_maxSampleSize = maxSampleSize;
_minStdDeviation = minStdDeviation;
_acceptableHeartbeatPause = acceptableHeartbeatPause;
_firstHeartbeatEstimate = firstHeartbeatEstimate;
state = new State(FirstHeartBeat, null);
}
示例11: NormalEvaporation
//Constructor
public NormalEvaporation(SoilWaterSoil SoilObject, Clock Clock)
{
cons = SoilObject.Constants;
salb = SoilObject.Salb;
summerCona = SoilObject.SummerCona;
summerU = SoilObject.SummerU;
summerDate = SoilObject.SummerDate;
winterCona = SoilObject.WinterCona;
winterU = SoilObject.WinterU;
winterDate = SoilObject.WinterDate;
// soilwat2_soil_property_param()
//u - can either use (one value for summer and winter) or two different values.
// (must also take into consideration where they enter two values [one for summer and one for winter] but they make them both the same)
if ((Double.IsNaN(summerU) || (Double.IsNaN(winterU))))
{
throw new Exception("A single value for u OR BOTH values for summeru and winteru must be specified");
}
//if they entered two values but they made them the same
if (summerU == winterU)
{
u = summerU; //u is now no longer null. As if the user had entered a value for u.
}
//cona - can either use (one value for summer and winter) or two different values.
// (must also take into consideration where they enter two values [one for summer and one for winter] but they make them both the same)
if ((Double.IsNaN(summerCona)) || (Double.IsNaN(winterCona)))
{
throw new Exception("A single value for cona OR BOTH values for summercona and wintercona must be specified");
}
//if they entered two values but they made them the same.
if (summerCona == winterCona)
{
cona = summerCona; //cona is now no longer null. As if the user had entered a value for cona.
}
//summer and winter default dates.
if (summerDate == "not_read")
{
summerDate = "1-oct";
}
if (winterDate == "not_read")
{
winterDate = "1-apr";
}
InitialiseAccumulatingVars(SoilObject, Clock);
}
示例12: MainForm
public MainForm()
{
InitializeComponent();
_clock = new Clock();
_trackerBrowser = new EyetrackerBrowser();
_trackerBrowser.EyetrackerFound += EyetrackerFound;
_trackerBrowser.EyetrackerUpdated += EyetrackerUpdated;
_trackerBrowser.EyetrackerRemoved += EyetrackerRemoved;
}
示例13: MainWindow
public MainWindow()
{
// Initialize Tobii SDK eyetracking library
Library.Init();
InitializeComponent();
clock = new Clock();
trackerBrowser = new EyetrackerBrowser();
trackerBrowser.EyetrackerFound += EyetrackerFound;
trackerBrowser.EyetrackerUpdated += EyetrackerUpdated;
trackerBrowser.EyetrackerRemoved += EyetrackerRemoved;
}
示例14: TrackerWrapper
public TrackerWrapper()
{
// Initialize Tobii SDK eyetracking library
Library.Init();
clock = new Clock();
trackerBrowser = new EyetrackerBrowser();
trackerBrowser.EyetrackerFound += EyetrackerFound;
trackerBrowser.EyetrackerUpdated += EyetrackerUpdated;
trackerBrowser.EyetrackerRemoved += EyetrackerRemoved;
smoother = new AverageWindow(10);
}
示例15: Run
public void Run(Clock clock, IMarginalEmissionState state, IDimensions dimensions)
{
var t = clock.Current;
var s = state;
if ((t.Value >= s.emissionperiod.Value) && (t.Value < (s.emissionperiod.Value + s.impulselength)))
{
s.modemission[t] = s.emission[t] + 1;
}
else
s.modemission[t] = s.emission[t];
}