Documentation ¶
Index ¶
- Constants
- func InvalidTestDuration() errors.HandlerError
- type Duration
- func (d Duration) Add(s Duration) Duration
- func (d Duration) ConvertToHHMMSS() (hours, minutes, seconds int)
- func (d Duration) Days() float64
- func (d Duration) GetDayInMonth() int
- func (d Duration) GetDayInWeek() int
- func (d Duration) GetDayInYear() int
- func (d Duration) GetHourInDay() int
- func (d Duration) GetMinuteInHour() int
- func (d Duration) GetMonthInYear() int
- func (d Duration) GetSecondInMinute() int
- func (d Duration) GetWeekInYear() int
- func (d Duration) Months() float64
- func (d Duration) Sub(s Duration) Duration
- func (dur *Duration) UnmarshalJSON(b []byte) error
- func (d Duration) Weeks() float64
- func (d Duration) Years() float64
Constants ¶
Some more common durations extending the constants of default time package. To count the number of units in a Duration, divide:
second := time.Second fmt.Print(int64(second/time.Millisecond)) // prints 1000
To convert an integer number of units to a Duration, multiply:
seconds := 10 fmt.Print(time.Duration(seconds)*time.Second) // prints 10s
Variables ¶
This section is empty.
Functions ¶
func InvalidTestDuration ¶
func InvalidTestDuration() errors.HandlerError
InvalidTestDuration returns an ErrorMessage describing that the test duration is invalid
Types ¶
type Duration ¶
Duration is an extended version of time.Duration. Provides some more functions for formatting and supports units greater than hours.
func GetDuration ¶
GetDuration gets the test case duration as Duration Returns -1 if the time is invalid
func NewDuration ¶
NewDuration is a constructor for Duration. You don't have to calculate the correct nanosecond-float-value of the Duration at your own, but simply insert it into this constructor.
func (Duration) Add ¶
Add sums up two Durations and return the result. Nothing will be changed at the summands
func (Duration) ConvertToHHMMSS ¶
ConvertToHHMMSS converts the Duration to hours, minutes and seconds. Precision is cut to seconds. Seconds are less 60, 60 seconds are one minutes Minutes are less 60, 60 minutes are one hour hours can be more than 24, when duration is longer than one day
func (Duration) GetDayInMonth ¶
GetDayInMonth returns the days of the partial month. This is not the whole duration in days!
func (Duration) GetDayInWeek ¶
GetDayInWeek returns the days of the partial week. This is not the whole duration in days!
func (Duration) GetDayInYear ¶
GetDayInYear returns the days of the partial year. This is not the whole duration in days!
func (Duration) GetHourInDay ¶
GetHourInDay returns the hours of the partial day. This is not the whole duration in hours!
func (Duration) GetMinuteInHour ¶
GetMinuteInHour returns the minutes of the partial hour. This is not the whole duration in minutes!
func (Duration) GetMonthInYear ¶
GetMonthInYear returns the months of the partial year. This is not the whole duration in months!
func (Duration) GetSecondInMinute ¶
GetSecondInMinute returns the seconds of the partial minute. This is not the whole duration in seconds!
func (Duration) GetWeekInYear ¶
GetWeekInYear returns the weeks of the partial year. This is not the whole duration in weeks!
func (Duration) Sub ¶
Sub subtracts the duration given as parameter from the duration on which function is called and return the result. Nothing will be changed at the given variables