Class Timestamps
- Namespace
- DiscordRPC
- Assembly
- DiscordRPC.dll
Structure representing the start and endtimes of a match.
[Serializable]
public class Timestamps
- Inheritance
-
Timestamps
- Inherited Members
Constructors
Timestamps()
Creates a empty timestamp object
public Timestamps()
Timestamps(DateTime)
Creates a timestamp with the set start time
public Timestamps(DateTime start)
Parameters
start
DateTime
Timestamps(DateTime, DateTime)
Creates a timestamp with a set duration
public Timestamps(DateTime start, DateTime end)
Parameters
Properties
End
The time the match will end. When included (not-null), the time in the rich presence will be shown as "00:01 remaining". This will override the "elapsed" to "remaining".
[JsonIgnore]
public DateTime? End { get; set; }
Property Value
EndUnixMilliseconds
[JsonProperty("end", NullValueHandling = NullValueHandling.Ignore)]
public ulong? EndUnixMilliseconds { get; set; }
Property Value
Now
A new timestamp that starts from the current time.
public static Timestamps Now { get; }
Property Value
Start
The time that match started. When included (not-null), the time in the rich presence will be shown as "00:01 elapsed".
[JsonIgnore]
public DateTime? Start { get; set; }
Property Value
StartUnixMilliseconds
Converts between DateTime and Milliseconds to give the Unix Epoch Time for the Start.
[JsonProperty("start", NullValueHandling = NullValueHandling.Ignore)]
public ulong? StartUnixMilliseconds { get; set; }
Property Value
Methods
FromTimeSpan(double)
Creates a new timestamp starting at the current time and ending in the supplied timespan
public static Timestamps FromTimeSpan(double seconds)
Parameters
seconds
doubleHow long the Timestamp will last for in seconds.
Returns
- Timestamps
Returns a new timestamp with given duration.
FromTimeSpan(TimeSpan)
Creates a new timestamp starting at current time and ending in the supplied timespan
public static Timestamps FromTimeSpan(TimeSpan timespan)
Parameters
timespan
TimeSpanHow long the Timestamp will last for.
Returns
- Timestamps
Returns a new timestamp with given duration.
FromUnixMilliseconds(ulong)
Converts a Unix Epoch time into a DateTime.
public static DateTime FromUnixMilliseconds(ulong unixTime)
Parameters
unixTime
ulongThe time in milliseconds since 1970 / 01 / 01
Returns
ToUnixMilliseconds(DateTime)
Converts a DateTime into a Unix Epoch time (in milliseconds).
public static ulong ToUnixMilliseconds(DateTime date)
Parameters
date
DateTimeThe datetime to convert