time: minor cleanup of operators (#9097)

pull/9100/head
Enzo 2021-03-03 23:56:14 +01:00 committed by GitHub
parent 822d20d2cc
commit 3e5a0dfc94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 8 deletions

View File

@ -3,19 +3,13 @@ module time
// operator `==` returns true if provided time is equal to time
[inline]
pub fn (t1 Time) == (t2 Time) bool {
if t1.unix == t2.unix && t1.microsecond == t2.microsecond {
return true
}
return false
return t1.unix == t2.unix && t1.microsecond == t2.microsecond
}
// operator `<` returns true if provided time is less than time
[inline]
pub fn (t1 Time) < (t2 Time) bool {
if t1.unix < t2.unix || (t1.unix == t2.unix && t1.microsecond < t2.microsecond) {
return true
}
return false
return t1.unix < t2.unix || (t1.unix == t2.unix && t1.microsecond < t2.microsecond)
}
// Time subtract using operator overloading.