func (s Slip) TotalTimeWorked() int {
	if s.Status == status.Started() {
		return timeNow() - s.Modified + s.Worked
	}
	return s.Worked
}
TotalTimeWorked returns the total time worked on a timeslip.
If a timeslip is currently started, the worked time is adjusted based
on the modified and current time.
package timeslip
import (
	"encoding/json"
	"fmt"
	"strings"
	"time"
	"github.com/google/uuid"
	"github.com/mrcook/time_warrior/timeslip/status"
	"github.com/mrcook/time_warrior/timeslip/worked"
)
type Slip struct {
	Project     string `json:"project"`
	Task        string `json:"task"`
	Description string `json:"description"`
	Started     int    `json:"started"`
	Worked      int    `json:"worked"`
	Finished    int    `json:"finished"`
	Modified    int    `json:"modified"`
	Status      string `json:"status"`
	UUID        string `json:"uuid"`
}
func New(name string) (*Slip, error) {
	currentTime := int(time.Now().Unix())
	project, task, err := parseProjectName(name)
	if err != nil {
		return nil, err
	}
	slip := &Slip{
		Project:     project,
		Task:        task,
		Description: "New Timeslip",
		Started:     currentTime,
		Modified:    currentTime,
		Status:      status.Started(),
		UUID:        uuid.New().String(),
	}
	return slip, nil
}
func Unmarshal(data []byte, slip *Slip) error {
	return json.Unmarshal(data, slip)
}
func (s *Slip) Pause() error {
	if s.isPaused() {
		return fmt.Errorf("slip is already paused")
	}
	s.Status = status.Paused()
	s.Worked += timeNow() - s.Modified
	s.Modified = timeNow()
	return nil
}
func (s Slip) isPaused() bool {
	return s.Status == status.Paused()
}
func (s *Slip) Resume() error {
	if s.Status == status.Started() {
		return fmt.Errorf("slip is already in progress")
	}
	s.Status = status.Started()
	s.Modified = timeNow()
	return nil
}
func (s *Slip) Done(description string) {
	currentTime := timeNow()
	if s.Status == status.Started() {
		s.Worked += currentTime - s.Modified
		s.Finished = currentTime
		s.Modified = currentTime
	} else {
		s.Finished = s.Modified
	}
	s.Description = description
	s.Status = status.Completed()
}
func (s *Slip) Adjust(adjustment string) error {
	if !s.isPaused() {
		return fmt.Errorf("only paused timeslips can be changed")
	}
	a := worked.WorkTime{}
	if err := a.FromString(adjustment); err != nil {
		return err
	}
	w := worked.WorkTime{}
	w.FromSeconds(s.Worked)
	w.Add(&a)
	s.Worked = w.ToSeconds()
	if s.Worked < 0 {
		s.Worked = 0
		return nil
	}
	now := timeNow()
	workedTime := s.Started + s.Worked
	if workedTime > s.Modified && workedTime <= now {
		s.Modified = workedTime
	} else if workedTime > now {
		s.Started = s.Modified - s.Worked
	}
	return nil
}
func (s Slip) Name() string {
	if s.Task == "" {
		return s.Project
	}
	return s.Project + "." + s.Task
}