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
83456TotalSeconds
83.456Days
0Hours
0Minutes
1Seconds
23Milliseconds
456IsNegative
FalseMore
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();