[skip ci] small refactor

This commit is contained in:
Brahim Hadriche committed 2025-06-09 16:19:47 -04:00
1 parent 2c513afafd
commit 4906b69f4a
4 files changed
+14 -39

No files matched your search

+3 -11
View File
@@ -44,19 +44,11 @@ function Update()
end if
if hours > 12
hours = hours - 12
hours -= 12
end if
hoursStr = hours.ToStr()
minutesStr = minutes.ToStr()
if hours < 10
hoursStr = "0" + hoursStr
end if
if minutes < 10
minutesStr = "0" + minutesStr
end if
hoursStr = hours.ToStr("%02d")
minutesStr = minutes.ToStr("%02d")
m.top.text = hoursStr + ":" + minutesStr + " " + ampm
end function
+4 -21
View File
@@ -143,27 +143,10 @@ function FormatTime(dateTime as object) as string
dateTime.Mark()
dateTime.ToLocalTime()
hours = dateTime.GetHours().ToStr()
if hours.Len() = 1
hours = "0" + hours
end if
minutes = dateTime.GetMinutes().ToStr()
if minutes.Len() = 1
minutes = "0" + minutes
end if
seconds = dateTime.GetSeconds().ToStr()
if seconds.Len() = 1
seconds = "0" + seconds
end if
milliseconds = dateTime.GetMilliseconds().ToStr()
if milliseconds.Len() = 1
milliseconds = "00" + milliseconds
else if milliseconds.Len() = 2
milliseconds = "0" + milliseconds
end if
hours = dateTime.GetHours().ToStr("%02d")
minutes = dateTime.GetMinutes().ToStr("%02d")
seconds = dateTime.GetSeconds().ToStr("%02d")
milliseconds = dateTime.GetMilliseconds().ToStr("%03d")
return "[" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + "]"
end function
+3 -7
View File
@@ -13,14 +13,10 @@ namespace TimeUtils
minutes = (length \ 60) mod 60
seconds = length mod 60
if seconds < 10
seconds = "0" + seconds.ToStr()
else
seconds = seconds.ToStr()
end if
seconds = seconds.ToStr("%02d")
if minutes < 10 and hours > 0
minutes = "0" + minutes.ToStr()
if hours > 0
minutes = minutes.ToStr("%02d")
else
minutes = minutes.ToStr()
end if