mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Use invariant culture in debug timer
This commit is contained in:
parent
100f3cc447
commit
705901703d
1 changed files with 14 additions and 11 deletions
|
@ -25,12 +25,13 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ShareX.HelpersLib
|
||||
{
|
||||
public class DebugTimer : IDisposable
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
public string Text { get; set; }
|
||||
|
||||
private Stopwatch timer;
|
||||
|
||||
|
@ -40,7 +41,7 @@ public DebugTimer(string text = null)
|
|||
timer = Stopwatch.StartNew();
|
||||
}
|
||||
|
||||
private void Write(string text, string timeText)
|
||||
private void Write(string time, string text = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
|
@ -49,20 +50,22 @@ private void Write(string text, string timeText)
|
|||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
timeText = text + ": " + timeText;
|
||||
Debug.WriteLine(text + ": " + time);
|
||||
}
|
||||
|
||||
Debug.WriteLine(timeText);
|
||||
}
|
||||
|
||||
public void WriteElapsedSeconds(string text = null)
|
||||
else
|
||||
{
|
||||
Write(text, timer.Elapsed.TotalSeconds.ToString("0.000") + " seconds.");
|
||||
Debug.WriteLine(time);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteElapsedMilliseconds(string text = null)
|
||||
{
|
||||
Write(text, timer.Elapsed.TotalMilliseconds + " milliseconds.");
|
||||
Write(timer.Elapsed.TotalMilliseconds.ToString("0.000", CultureInfo.InvariantCulture) + " milliseconds.", text);
|
||||
}
|
||||
|
||||
public void WriteElapsedSeconds(string text = null)
|
||||
{
|
||||
Write(timer.Elapsed.TotalSeconds.ToString("0.000", CultureInfo.InvariantCulture) + " seconds.", text);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
Loading…
Reference in a new issue