diff --git a/pkg/ottl/README.md b/pkg/ottl/README.md index 1761db5aeef5..65e33189a77e 100644 --- a/pkg/ottl/README.md +++ b/pkg/ottl/README.md @@ -172,8 +172,8 @@ When defining an OTTL function, if the function needs to take an Enum then the f Math Expressions represent arithmetic calculations. They support `+`, `-`, `*`, and `/`, along with `()` for grouping. -Math Expressions currently support `int64` and`float64`. -Math Expressions also support `time.Time` and `time.Duration`, but only with `+` and `-` and only using the following rules: +Math Expressions currently support `int64`, `float64`, `time.Time` and `time.Duration`. +For `time.Time` and `time.Duration`, only `+` and `-` are supported with the following rules: - A `time.Time` `-` a `time.Time` yields a `time.Duration`. - A `time.Duration` `+` a `time.Time` yields a `time.Time`. - A `time.Time` `-` a `time.Duration` yields a `time.Time`. diff --git a/pkg/ottl/math.go b/pkg/ottl/math.go index 9adbd8499256..897ed22c3ade 100644 --- a/pkg/ottl/math.go +++ b/pkg/ottl/math.go @@ -130,7 +130,7 @@ func performOpTime(x time.Time, y any, op mathOp) (any, error) { result := x.Add(-1 * newY) return result, nil default: - return nil, fmt.Errorf("time.Time must be subtracted from time.Time or time.Duration; found %v instead", y) + return nil, fmt.Errorf("time.Time or time.Duration must be subtracted from time.Time; found %v instead", y) } } return nil, fmt.Errorf("only addition and subtraction supported for time.Time and time.Duration")