Add class duration to time command output

This commit is contained in:
2024-01-07 08:37:43 -06:00
parent 49e5a406d7
commit b4b2930a58
2 changed files with 8 additions and 1 deletions

View File

@@ -162,6 +162,10 @@ type NaiveTime struct {
Minutes uint
}
func (nt NaiveTime) Sub(other NaiveTime) time.Duration {
return time.Hour*time.Duration(nt.Hours-other.Hours) + time.Minute*time.Duration(nt.Minutes-other.Minutes)
}
func ParseNaiveTime(integer uint64) NaiveTime {
minutes := uint(integer % 100)
hours := uint(integer / 100)