-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
72 lines (57 loc) · 2.1 KB
/
Form1.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;
namespace TimeInTarkovDesk
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
SetTimer();
}
private void SetTimer()
{
DispatcherTimer timer = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(10)
};
timer.Tick += TimeInTarkov;
timer.Start();
}
private void TimeInTarkov(object sender, EventArgs e)
{
//in Tarkov vergeht die zeit X mal schneller
int tarkovTimeTranslator = 7;
//umrechnung normal zu unixtime (stunde)
//ms * sekunden * minuten
int dayInUnixtime = 1000 * 60 * 60 * 24;
//Korrektur Zeitzone Russland ( UTC +3 )
//Konventieren von utc zu "Russian Standard Time" +3 UTC
int utctorst = 1000 * 60 * 60 * 3;
//Konvertiert in UnixTime und führt berechnung durch
long unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
unixTimestamp = unixTimestamp * tarkovTimeTranslator % dayInUnixtime;
unixTimestamp += utctorst;
//Konvertiert Unix zurück in Datetime
DateTime tarkovTime = DateTimeOffset.FromUnixTimeMilliseconds(unixTimestamp).DateTime;
//Setz die differenz zur zweiten zeit
TimeSpan diftotimetwo = new TimeSpan(12, 0, 0);
DateTime tarkovTime2 = tarkovTime.Add(diftotimetwo);
//aktualliesiert die Oberfläche
label1.Text = tarkovTime.ToString("HH:mm:ssf");
label2.Text = tarkovTime2.ToString("HH:mm:ssf");
}
private void panel1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://www.paypal.com/donate/?hosted_button_id=LP8T8Z36YPWD8");
}
}
}