Created
November 22, 2019 06:20
-
-
Save imgen/90bf5e255ebd88c6d54d946bd6e29fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string FormatTimeSpan(TimeSpan timeSpan) | |
{ | |
var (minutes, seconds, milliseconds, microseconds) = ( | |
(int)timeSpan.TotalMinutes, | |
timeSpan.Seconds, | |
timeSpan.Milliseconds, | |
int.Parse(timeSpan.ToString("ffffff").Substring(3)) | |
); | |
return $"{minutes}m {seconds}s {milliseconds}ms {microseconds}μs"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment