Skip to content

Commit

Permalink
Correctly round seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Sep 20, 2020
1 parent c9e3471 commit 00b9a76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ClockLib/OWClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ private void AddEvent(string text)
string ParseTime(float timestamp)
{
var minutes = Mathf.Floor(timestamp / 60f).ToString().PadLeft(2, '0');
var seconds = Mathf.Round(timestamp % 60f * 100f / 100f).ToString().PadLeft(2, '0');
var seconds = Math.Truncate(timestamp % 60f).ToString().PadLeft(2, '0');
var clock = $"{minutes}:{seconds}";
if (Milliseconds)
{
var milliseconds = Math.Round((timestamp - Math.Floor(timestamp)) * 1000).ToString().PadLeft(3, '0');
var milliseconds = Math.Truncate((timestamp - Math.Floor(timestamp)) * 1000).ToString().PadLeft(3, '0');
clock = $"{clock}.{milliseconds}";
}
return clock;
Expand Down
2 changes: 1 addition & 1 deletion ClockLib/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "Clock",
"uniqueName": "clubby789.OWClock",
"description": "Add a clock overlay",
"version": "0.2.5",
"version": "0.2.6",
"owmlVersion": "0.7.3"
}

0 comments on commit 00b9a76

Please sign in to comment.