(61d00a474) v0.9.7.1

This commit is contained in:
Regalis
2020-03-04 13:04:10 +01:00
parent 3c50efa5c9
commit 3c09ebe02f
5086 changed files with 786063 additions and 295871 deletions
@@ -0,0 +1,24 @@
using System;
namespace Steamworks
{
static internal class Epoch
{
private static readonly DateTime epoch = new DateTime( 1970, 1, 1, 0, 0, 0, DateTimeKind.Utc );
/// <summary>
/// Returns the current Unix Epoch
/// </summary>
public static int Current => (int)(DateTime.UtcNow.Subtract( epoch ).TotalSeconds);
/// <summary>
/// Convert an epoch to a datetime
/// </summary>
public static DateTime ToDateTime( decimal unixTime ) => epoch.AddSeconds( (long)unixTime );
/// <summary>
/// Convert a DateTime to a unix time
/// </summary>
public static uint FromDateTime( DateTime dt ) => (uint)(dt.Subtract( epoch ).TotalSeconds);
}
}