Lachee / discord-rpc-csharp

C# custom implementation for Discord Rich Presence. Not deprecated and still available!
MIT License
579 stars 96 forks source link

How to set the End timestamp correctly? #42

Closed Joe112Carlos closed 6 years ago

Joe112Carlos commented 6 years ago

Hi! I know this isn`t really an issue, anyways ive been trying to set the "Time Left" ( 00:00 Left) Thingy and it always says 00:00 Left when i try it. Defining the time when its over: DateTime timeover = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour + Hours, DateTime.UtcNow.Minute + Minutes, DateTime.UtcNow.Second + 10); Setting Timestamps:

Timestamps = new DiscordRPC.Timestamps() { Start = DateTime.UtcNow, End = timeover }

Hours and Minutes are an Int defined by a NumericUpDown

Lachee commented 6 years ago

Sorry, this issue was fixed a few commits ago but the fixed caused a issue further down the line with Discord returning unexpected values back for the time (see issue https://github.com/discordapp/discord-rpc/issues/231 ). This has since been fixed in this library and you will just need to update your build.

I also recommend trying this instead:

DateTime timeover = DateTime.UtcNow + TimeSpan.FromSeconds(10);

Cheers

Joe112Carlos commented 6 years ago

Thanks again! :)