Time formatting

TimeInt32 stores milliseconds and TimeSingle stores seconds, the way the games store times. Both take half the size of TimeSpan and format the way Trackmania shows times.

Formats

ToTmString()
1:23.456
ToTmString(useHundredths: true)
1:23.45
ToTmString(useApostrophe: true)
1'23''456
ToTmString(compact: true)
1:23.456
ToTmString(useHundredths: true, useApostrophe: true, compact: true)
1'23''45
ToTimeSingle().ToTmString()
1:23.456
((TimeSpan)time).ToTmString()
1:23.456

Parts

TotalMilliseconds 83456
TotalSeconds 83.456
Days 0
Hours 0
Minutes 1
Seconds 23
Milliseconds 456
IsNegative False

More

No time

Nullable times format to the placeholder the game shows.

-:--.---
-'--''---
TimeInt32? time = null; time.ToTmString();

Bind to inputs

A TypeConverter lets inputs bind to the time directly.

1:23.45
<input @bind="time" />

TimeSingle

The same formats for seconds as a float, like checkpoint times in replays.

1:23.456
new TimeSingle(83.456f) .ToTmString();
An unhandled error has occurred. Reload 🗙