MCPcopy Create free account
hub / github.com/github/gh-aw / intervalToMinutes

Function intervalToMinutes

pkg/parser/schedule_parser.go:263–278  ·  view source on GitHub ↗
(interval int, unit string)

Source from the content-addressed store, hash-verified

261}
262
263func intervalToMinutes(interval int, unit string) (int, error) {
264 switch unit {
265 case "m", "minutes":
266 return interval, nil
267 case "h", "hours":
268 return interval * 60, nil
269 case "d", "days":
270 return interval * 24 * 60, nil
271 case "w":
272 return interval * 7 * 24 * 60, nil
273 case "mo":
274 return interval * 30 * 24 * 60, nil
275 default:
276 return 0, fmt.Errorf("unsupported duration unit '%s'", unit)
277 }
278}
279
280func formatShortDurationCron(interval int, unit string, hasWeekdaysSuffix bool) (string, error) {
281 switch unit {

Callers 1

validateMinimumIntervalFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected