OLD | NEW |
(Empty) | |
| 1 /* |
| 2 Copyright 2013 Google Inc |
| 3 |
| 4 Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 you may not use this file except in compliance with the License. |
| 6 You may obtain a copy of the License at |
| 7 |
| 8 http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
| 10 Unless required by applicable law or agreed to in writing, software |
| 11 distributed under the License is distributed on an "AS IS" BASIS, |
| 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 See the License for the specific language governing permissions and |
| 14 limitations under the License. |
| 15 */ |
| 16 |
| 17 using System; |
| 18 |
| 19 namespace Google.Apis.Util |
| 20 { |
| 21 /// <summary>Clock wrapper for getting the current time.</summary> |
| 22 public interface IClock |
| 23 { |
| 24 /// <summary> |
| 25 /// Gets a <seealso cref="DateTime"/> object that is set to the current
date and time on this computer,· |
| 26 /// expressed as the local time. |
| 27 /// </summary> |
| 28 DateTime Now { get; } |
| 29 } |
| 30 |
| 31 /// <summary>A default clock implementation that wraps the <seealso cref="Da
teTime.Now"/> property.</summary> |
| 32 public class SystemClock : IClock |
| 33 { |
| 34 /// <summary>Constructs a new system clock.</summary> |
| 35 protected SystemClock() { } |
| 36 |
| 37 /// <summary>The default instance.</summary> |
| 38 public static readonly IClock Default = new SystemClock(); |
| 39 |
| 40 public DateTime Now |
| 41 { |
| 42 get { return DateTime.Now; } |
| 43 } |
| 44 } |
| 45 } |
OLD | NEW |