Add project files.

This commit is contained in:
Martijn Dijkstra
2025-05-08 09:10:15 +02:00
parent 7be30a6f28
commit 6a44bd4fd2
211 changed files with 729572 additions and 0 deletions

48
Maser.Feanor/Time.cs Normal file
View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Maser.Feanor.Model
{
public static class Time
{
public static DateTime UnixToDatetime(Int32 UnixStamp)
{
DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0);
return dt.AddSeconds(UnixStamp);
}
public static Int32 DatetimeToUnix(DateTime datetime)
{
return (Int32)(datetime.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
}
public static DateTime UTC
{ // Return UTC time
get {return DateTime.Now.ToUniversalTime(); }
}
public static DateTime Local
{
// Return the local time in The Netherlands
get {return DateTime.Now; }
}
public static DateTime LocalToUtc(DateTime Local)
{
// Return the UTC time at given local time in The Netherlands
return Local.ToUniversalTime();
}
public static DateTime UtcToLocal(DateTime UTC)
{
// Return the local time in The Netherlands at given UTC time
return UTC.ToLocalTime();
}
}
}