func (w *WorkTime) Subtract(nu *WorkTime) {
	seconds := w.ToSeconds() - nu.ToSeconds()
	w.FromSeconds(seconds)
}
Subtract one worked time from another.
package worked
import (
	"fmt"
	"strconv"
	"strings"
)
type WorkTime struct {
	Hours   int
	Minutes int
	Seconds int
}
func (w *WorkTime) FromHours(hours int) {
	w.Hours = hours
}
func (w *WorkTime) FromMinutes(minutes int) {
	w.Hours = minutes / 60
	w.Minutes = minutes % 60
}
func (w *WorkTime) FromSeconds(seconds int) {
	w.Hours = seconds / 3600
	remainder := seconds % 3600
	w.Minutes = remainder / 60
	w.Seconds = remainder % 60
}
func (w *WorkTime) FromString(adjustment string) error {
	adjustment = strings.TrimSpace(adjustment)
	if strings.Contains(adjustment, " ") {
		return fmt.Errorf("invalid time unit, should not contain spaces")
	}
	unit := adjustment[len(adjustment)-1:]
	value := adjustment[:len(adjustment)-1]
	if len(unit) != 1 || !strings.ContainsAny(unit, "hms") {
		return fmt.Errorf("invalid time unit, got '%s'", unit)
	}
	hasNegative := value[0] == '-'
	hasPositive := value[0] == '+'
	if hasNegative || hasPositive {
		value = adjustment[1 : len(adjustment)-1]
	}
	switch unit {
	case "h":
		h, err := strconv.Atoi(value)
		if err != nil {
			return fmt.Errorf("unable to process input")
		}
		w.FromHours(h)
	case "m":
		m, err := strconv.Atoi(value)
		if err != nil {
			return fmt.Errorf("unable to process input")
		}
		w.FromMinutes(m)
	case "s":
		s, err := strconv.Atoi(value)
		if err != nil {
			return fmt.Errorf("unable to process input")
		}
		w.FromSeconds(s)
	default:
		return fmt.Errorf("unable to process input")
	}
	if hasNegative {
		w.Hours = -w.Hours
		w.Minutes = -w.Minutes
		w.Seconds = -w.Seconds
	}
	return nil
}
func (w WorkTime) String() string {
	if w.Hours != 0 && w.Minutes != 0 {
		return fmt.Sprintf("%dh %dm", w.Hours, w.Minutes)
	} else if w.Minutes != 0 && w.Seconds != 0 {
		return fmt.Sprintf("%dm %ds", w.Minutes, w.Seconds)
	}
	if w.Hours != 0 {
		return fmt.Sprintf("%d hours", w.Hours)
	} else if w.Minutes != 0 {
		return fmt.Sprintf("%d minutes", w.Minutes)
	}
	return fmt.Sprintf("%d seconds", w.Seconds)
}
func (w WorkTime) ToSeconds() int {
	hours := w.Hours * 60 * 60
	minutes := w.Minutes * 60
	return hours + minutes + w.Seconds
}
func (w *WorkTime) Add(nu *WorkTime) {
	seconds := w.ToSeconds() + nu.ToSeconds()
	w.FromSeconds(seconds)
}