MCPcopy Create free account
hub / github.com/SolarLune/masterplan / SetScheduleTime

Method SetScheduleTime

contents.go:1889–1916  ·  view source on GitHub ↗
(hour, minute int)

Source from the content-addressed store, hash-verified

1887}
1888
1889func (tc *TimerContents) SetScheduleTime(hour, minute int) string {
1890
1891 if hour <= 0 && minute < 0 {
1892 hour = 23
1893 minute = 59
1894 } else if hour == 24 && minute >= 0 || minute >= 1440 {
1895 hour = 0
1896 minute = 1
1897 }
1898
1899 for minute >= 60 {
1900 minute -= 60
1901 hour++
1902 }
1903
1904 for hour > 24 {
1905 hour -= 24
1906 }
1907
1908 tc.Card.Properties.Get("schedule hour").Set(float64(hour))
1909 tc.Card.Properties.Get("schedule minute").Set(float64(minute))
1910 tc.ScheduleTime = time.Duration((hour * int(time.Hour)) + (minute * int(time.Minute)))
1911
1912 tc.UpdateTargetTimerText()
1913
1914 return tc.TargetTimeLabel.TextAsString()
1915
1916}
1917
1918func (tc *TimerContents) UpdateTargetTimerText() {
1919 var big, small int

Callers 1

NewTimerContentsFunction · 0.95

Calls 4

UpdateTargetTimerTextMethod · 0.95
TextAsStringMethod · 0.80
SetMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected