corrade-vassal – Diff between revs 13 and 14

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 13 Rev 14
Line 16... Line 16...
16 { 16 {
17 public class Time 17 public class Time
18 { 18 {
19 public delegate void TimerCallback(object state); 19 public delegate void TimerCallback(object state);
Line -... Line 20...
-   20  
-   21 /// <summary>
-   22 /// Convert an Unix timestamp to a DateTime structure.
-   23 /// </summary>
-   24 /// <param name="unixTimestamp">the Unix timestamp to convert</param>
-   25 /// <returns>the DateTime structure</returns>
-   26 /// <remarks>the function assumes UTC time</remarks>
-   27 public static DateTime UnixTimestampToDateTime(uint unixTimestamp)
-   28 {
-   29 return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unixTimestamp).ToUniversalTime();
-   30 }
-   31  
-   32 /// <summary>
-   33 /// Convert a DateTime structure to a Unix timestamp.
-   34 /// </summary>
-   35 /// <param name="dateTime">the DateTime structure to convert</param>
-   36 /// <returns>the Unix timestamp</returns>
-   37 /// <remarks>the function assumes UTC time</remarks>
-   38 public static uint DateTimeToUnixTimestamp(DateTime dateTime)
-   39 {
-   40 return (uint) (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;
-   41 }
20   42  
21 public sealed class Timer : IDisposable 43 public sealed class Timer : IDisposable
22 { 44 {
23 private static readonly Task CompletedTask = Task.FromResult(false); 45 private static readonly Task CompletedTask = Task.FromResult(false);
24 private readonly TimerCallback Callback; 46 private readonly TimerCallback Callback;