func formatTimeSpan(timeSpan string) (string, error) {
	endtime := time.Now().UTC().Format(time.RFC3339)
	starttime := time.Now().Add(-(5 * time.Minute)).UTC().Format(time.RFC3339)
	if timeSpan != "" {
		aggregationInterval := strings.Split(timeSpan, ":")
		hours, herr := strconv.Atoi(aggregationInterval[0])
		minutes, merr := strconv.Atoi(aggregationInterval[1])
		seconds, serr := strconv.Atoi(aggregationInterval[2])

		if herr != nil || merr != nil || serr != nil {
			return "", fmt.Errorf("Errors parsing metricAggregationInterval: %v, %v, %v", herr, merr, serr)
		}

		starttime = time.Now().Add(-(time.Duration(hours)*time.Hour + time.Duration(minutes)*time.Minute + time.Duration(seconds)*time.Second)).UTC().Format(time.RFC3339)
	}
	return fmt.Sprintf("%s/%s", starttime, endtime), nil
}
// formatTimeSpan defaults to a 5 minute timespan if the user does not provide one
formatTimeSpan defaults to a 5 minute timespan if the user does not provide one
// formatTimeSpan defaults to a 5 minute timespan if the user does not provide one
func formatTimeSpan(timeSpan string) (string, error) {
	endtime := time.Now().UTC().Format(time.RFC3339)
	starttime := time.Now().Add(-(5 * time.Minute)).UTC().Format(time.RFC3339)
	if timeSpan != "" {
		aggregationInterval := strings.Split(timeSpan, ":")
		hours, herr := strconv.Atoi(aggregationInterval[0])
		minutes, merr := strconv.Atoi(aggregationInterval[1])
		seconds, serr := strconv.Atoi(aggregationInterval[2])
		if herr != nil || merr != nil || serr != nil {
			return "", fmt.Errorf("Errors parsing metricAggregationInterval: %v, %v, %v", herr, merr, serr)
		}
		starttime = time.Now().Add(-(time.Duration(hours)*time.Hour + time.Duration(minutes)*time.Minute + time.Duration(seconds)*time.Second)).UTC().Format(time.RFC3339)
	}
	return fmt.Sprintf("%s/%s", starttime, endtime), nil
}
func formatTimeSpan ( timeSpan string ) ( string , error ) { endtime := time . Now ( ) . UTC ( ) . Format ( time . RFC3339 ) starttime := time . Now ( ) . Add ( - ( 5 * time . Minute ) ) . UTC ( ) . Format ( time . RFC3339 ) if timeSpan != " " { aggregationInterval := strings . Split ( timeSpan , " " ) hours , herr := strconv . Atoi ( aggregationInterval [ 0 ] ) minutes , merr := strconv . Atoi ( aggregationInterval [ 1 ] ) seconds , serr := strconv . Atoi ( aggregationInterval [ 2 ] ) if herr != nil || merr != nil || serr != nil { return " " , fmt . Errorf ( " " , herr , merr , serr ) } starttime = time . Now ( ) . Add ( - ( time . Duration ( hours ) * time . Hour + time . Duration ( minutes ) * time . Minute + time . Duration ( seconds ) * time . Second ) ) . UTC ( ) . Format ( time . RFC3339 ) } return fmt . Sprintf ( " " , starttime , endtime ) , nil }
formatTimeSpan defaults to a 5 minute timespan if the user does not provide one
formatTimeSpan defaults to a 5 minute timespan if the user does not provide one