Table of Contents

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

start DateTime

The start time

end DateTime

The end time

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

DateTime?

EndUnixMilliseconds

Converts between DateTime and Milliseconds to give the Unix Epoch Time for the End. End

[JsonProperty("end", NullValueHandling = NullValueHandling.Ignore)]
public ulong? EndUnixMilliseconds { get; set; }

Property Value

ulong?

Now

A new timestamp that starts from the current time.

public static Timestamps Now { get; }

Property Value

Timestamps

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

DateTime?

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

ulong?

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 double

How 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 TimeSpan

How 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 ulong

The time in milliseconds since 1970 / 01 / 01

Returns

DateTime

ToUnixMilliseconds(DateTime)

Converts a DateTime into a Unix Epoch time (in milliseconds).

public static ulong ToUnixMilliseconds(DateTime date)

Parameters

date DateTime

The datetime to convert

Returns

ulong