15357fd3c0
yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarba
28 lines
783 B
Go
28 lines
783 B
Go
package utils
|
|
|
|
// formatPace форматирует темп в строку "MM:SS"
|
|
func FormatPace(minutes, seconds int) string {
|
|
if seconds >= 60 {
|
|
minutes += seconds / 60
|
|
seconds = seconds % 60
|
|
}
|
|
return FormatTwoDigits(minutes) + ":" + FormatTwoDigits(seconds)
|
|
}
|
|
|
|
// formatTwoDigits форматирует число в двузначную строку
|
|
func FormatTwoDigits(num int) string {
|
|
if num < 10 {
|
|
return "0" + string(rune(num+'0'))
|
|
}
|
|
return string(rune(num/10+'0')) + string(rune(num%10+'0'))
|
|
}
|
|
|
|
// formatTime форматирует время в строку "MM:SS"
|
|
func FormatTime(minutes, seconds int) string {
|
|
if seconds >= 60 {
|
|
minutes += seconds / 60
|
|
seconds = seconds % 60
|
|
}
|
|
return FormatTwoDigits(minutes) + ":" + FormatTwoDigits(seconds)
|
|
}
|