Documentation
¶
Index ¶
- func DurationBetween(start Time, end Time) time.Duration
- func TimePointer(t time.Time) *time.Time
- type Time
- func (t Time) Add(d time.Duration) Time
- func (t Time) After(comparison Time) bool
- func (t Time) Before(comparison Time) bool
- func (t Time) HoursMinutesSeconds() (int, int, int)
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(src interface{}) error
- func (t *Time) String() string
- func (t Time) Sub(d time.Duration) Time
- func (t *Time) Today(timezone string) time.Time
- func (t Time) TotalSeconds() int
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t *Time) Value() (driver.Value, error)
- func (t Time) Within(start Time, end Time) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationBetween ¶
DurationBetween returns the duration between the two times. If start occurs after end, then the returned duration assumes that end refers to the following day.
Types ¶
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time deals only with hours, minutes, and seconds. As opposed to the native time.Time struct that deals also with dates & timezones.
func Now ¶
Now returns the current Time at the sepcified timezone. If an invalid timezone is given, then UTC is used.
func ParseTime ¶
ParseTime takes in a string of the format: hh:mm:ss and returns a parsed Time object. If the string is not in a valid format ErrInvalidTimeFormat is returned.
func (Time) HoursMinutesSeconds ¶
HoursMinutesSeconds returns the given hours, minutes, and seconds within the Time object.
func (Time) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Time) Today ¶
Today converts the Time object into a time.Time at the current date given a timezone.
func (Time) TotalSeconds ¶
TotalSeconds returns the total amount of seconds into the day that this Time object is.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.