time: minor cleanup of operators (#9097)
parent
822d20d2cc
commit
3e5a0dfc94
|
@ -3,19 +3,13 @@ module time
|
||||||
// operator `==` returns true if provided time is equal to time
|
// operator `==` returns true if provided time is equal to time
|
||||||
[inline]
|
[inline]
|
||||||
pub fn (t1 Time) == (t2 Time) bool {
|
pub fn (t1 Time) == (t2 Time) bool {
|
||||||
if t1.unix == t2.unix && t1.microsecond == t2.microsecond {
|
return t1.unix == t2.unix && t1.microsecond == t2.microsecond
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// operator `<` returns true if provided time is less than time
|
// operator `<` returns true if provided time is less than time
|
||||||
[inline]
|
[inline]
|
||||||
pub fn (t1 Time) < (t2 Time) bool {
|
pub fn (t1 Time) < (t2 Time) bool {
|
||||||
if t1.unix < t2.unix || (t1.unix == t2.unix && t1.microsecond < t2.microsecond) {
|
return t1.unix < t2.unix || (t1.unix == t2.unix && t1.microsecond < t2.microsecond)
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time subtract using operator overloading.
|
// Time subtract using operator overloading.
|
||||||
|
|
Loading…
Reference in New Issue