Этот код, таймер или нет? - C#
Формулировка задачи:
namespace Un4seen.Bass.Misc { using System; using System.ComponentModel; using System.Runtime.InteropServices; using System.Security; using System.Threading; [SuppressUnmanagedCodeSecurity] public sealed class HiPerfTimer { private long freq; private long startTime; private long stopTime; public HiPerfTimer() { if (!QueryPerformanceFrequency(out this.freq)) { throw new Win32Exception(); } } [DllImport("Kernel32.dll")] private static extern bool QueryPerformanceCounter(out long lpPerformanceCount); [DllImport("Kernel32.dll")] private static extern bool QueryPerformanceFrequency(out long lpFrequency); public void Start() { Thread.Sleep(0); QueryPerformanceCounter(out this.startTime); } public void Stop() { QueryPerformanceCounter(out this.stopTime); } public double Duration { get { return (((double) (this.stopTime - this.startTime)) / ((double) this.freq)); } } } }
Решение задачи: «Этот код, таймер или нет?»
textual
Листинг программы
Thread.Sleep(500);
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д