StopwatchImpl.cs 946 B

123456789101112131415161718192021222324252627282930
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. #if !NO_STOPWATCH
  5. using System.Diagnostics;
  6. namespace System.Reactive.Concurrency
  7. {
  8. //
  9. // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
  10. // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
  11. // behavior of Rx for PLIB when used on a more capable platform.
  12. //
  13. internal class /*Default*/StopwatchImpl : IStopwatch
  14. {
  15. private readonly Stopwatch _sw;
  16. public StopwatchImpl()
  17. {
  18. _sw = Stopwatch.StartNew();
  19. }
  20. public TimeSpan Elapsed
  21. {
  22. get { return _sw.Elapsed; }
  23. }
  24. }
  25. }
  26. #endif