-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnixTimestamp.cs
30 lines (25 loc) · 1.15 KB
/
UnixTimestamp.cs
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
// Decompiled with JetBrains decompiler
// Type: s2fit.UnixTimestamp
// Assembly: s2fit, Version=2013.3.18.9, Culture=neutral, PublicKeyToken=null
// MVID: 2E7A4E2C-2CBB-4E29-BE48-9870B53D7378
// Assembly location: C:\Users\JoséMaríaFloresZazo\Downloads\SCALE2FIT\s2fit.exe
using System;
namespace s2fit
{
public class UnixTimestamp
{
private DateTime mdtIniUnixDate;
public UnixTimestamp() => this.mdtIniUnixDate = new DateTime(1970, 1, 1, 0, 0, 0);
public DateTime GetDate(long TimestampToConvert, bool Local) => Local ? this.mdtIniUnixDate.AddSeconds((double) TimestampToConvert).ToLocalTime() : this.mdtIniUnixDate.AddSeconds((double) TimestampToConvert);
public long GetUnixTimestamp(
DateTime DateToConvert,
bool Local,
int Hour = 0,
int Minut = 0,
int Second = 0)
{
DateTime dateTime = new DateTime(DateToConvert.Year, DateToConvert.Month, DateToConvert.Day, Hour, Minut, Second);
return Local ? checked ((long) Math.Round(dateTime.ToUniversalTime().Subtract(this.mdtIniUnixDate).TotalSeconds)) : checked ((long) Math.Round(dateTime.Subtract(this.mdtIniUnixDate).TotalSeconds));
}
}
}