daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Dec 14th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Main()
  2. {
  3.     var startTime = DateTime.Now;
  4.     var timer = new System.Timers.Timer(500);
  5.     timer.AutoReset = false;
  6.     timer.Elapsed += new ElapsedEventHandler((sender, e) => {
  7.         var totalTime = DateTime.Now - startTime;
  8.         totalTime.Dump();
  9.     });
  10.     timer.Start();
  11.     SpinWait.SpinUntil(() => (DateTime.Now - startTime).TotalMilliseconds >= 250);
  12.     var elapsed = (DateTime.Now - startTime);
  13.     ("elapsed: " + elapsed).Dump();
  14.     timer.Stop();
  15.     timer.Start();
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top