Change project layout to make easier debug / tests"

This commit is contained in:
eleksir
2024-09-22 23:52:57 +03:00
parent 9d3bc186cc
commit 4bff21f4c7
112 changed files with 271 additions and 1683 deletions

27
internal/lib/clock.go Normal file
View File

@@ -0,0 +1,27 @@
package lib
import (
"fmt"
"time"
)
// UpdateClock get and updates (on i3bar) info about system clock.
func (c MyConfig) UpdateClock() {
for {
currentTime := time.Now()
hours, minutes, _ := currentTime.Clock()
year, month, day := currentTime.Date()
dow := currentTime.Weekday()
rmonth := [12]string{"Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Окт", "Ноя", "Дек"}
rdow := [7]string{"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"}
myclock := fmt.Sprintf(" %s, %d %s %d % 2d:%02d ", rdow[dow], day, rmonth[month-1], year, hours, minutes)
if myclock != c.ClockTime {
c.ClockTime = myclock
c.UpdateReady <- true
}
time.Sleep(1 * time.Second)
}
}