blob: 1caaff5b0eb8324b0ecbbe62feaa4cb1d3143049 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using System;
namespace jive.utility
{
public static class Clock
{
private static Func<DateTime> time_provider;
static Clock()
{
reset();
}
public static Date today()
{
return time_provider();
}
public static DateTime now()
{
return time_provider();
}
#if DEBUG
public static void change_time_provider_to(Func<DateTime> new_time_provider)
{
if (new_time_provider != null) time_provider = new_time_provider;
}
#endif
public static void reset()
{
time_provider = () => DateTime.Now;
}
}
}
|