diff --git a/vlib/time/operator.v b/vlib/time/operator.v index fae0ad3fe6..fff2c5590f 100644 --- a/vlib/time/operator.v +++ b/vlib/time/operator.v @@ -24,9 +24,9 @@ pub fn (t1 Time) < (t2 Time) bool { return false } -// le returns true if provided time is less or equal to time +// operator `<=` returns true if provided time is less or equal to time [inline] -pub fn (t1 Time) le(t2 Time) bool { +pub fn (t1 Time) <= (t2 Time) bool { return t1 < t2 || t1 == t2 } @@ -39,9 +39,9 @@ pub fn (t1 Time) > (t2 Time) bool { return false } -// ge returns true if provided time is greater or equal to time +// operator `>=` returns true if provided time is greater or equal to time [inline] -pub fn (t1 Time) ge(t2 Time) bool { +pub fn (t1 Time) >= (t2 Time) bool { return t1 > t2 || t1 == t2 } diff --git a/vlib/time/operator_test.v b/vlib/time/operator_test.v index 3a60791053..9961071446 100644 --- a/vlib/time/operator_test.v +++ b/vlib/time/operator_test.v @@ -221,8 +221,8 @@ fn test_time1_should_be_greater_or_equal_to_time2_when_gt() { second: 4 microsecond: 0 }) - assert t1.ge(t2) - assert t3.ge(t4) + assert t1 >= t2 + assert t3 >= t4 } fn test_time1_should_be_greater_or_equal_to_time2_when_eq() { @@ -264,8 +264,8 @@ fn test_time1_should_be_greater_or_equal_to_time2_when_eq() { second: 3 microsecond: 0 }) - assert t1.ge(t2) - assert t3.ge(t4) + assert t1 >= t2 + assert t3 >= t4 } fn test_time1_should_be_less_or_equal_to_time2_when_lt() { @@ -307,8 +307,8 @@ fn test_time1_should_be_less_or_equal_to_time2_when_lt() { second: 4 microsecond: 0 }) - assert t1.le(t2) - assert t3.le(t4) + assert t1 <= t2 + assert t3 <= t4 } fn test_time1_should_be_less_or_equal_to_time2_when_eq() { @@ -350,8 +350,8 @@ fn test_time1_should_be_less_or_equal_to_time2_when_eq() { second: 3 microsecond: 0 }) - assert t1.le(t2) - assert t3.le(t4) + assert t1 <= t2 + assert t3 <= t4 } fn test_time2_copied_from_time1_should_be_equal() {