Fix no_float bug in time.
This commit is contained in:
@@ -34,10 +34,10 @@ mod time_functions {
|
||||
pub fn elapsed(timestamp: &mut Instant) -> Result<Dynamic, Box<EvalAltResult>> {
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
{
|
||||
if *timestamp <= Instant::now() {
|
||||
Ok((timestamp.elapsed().as_secs_f64() as FLOAT).into())
|
||||
} else {
|
||||
if *timestamp > Instant::now() {
|
||||
Err(make_arithmetic_err("Time-stamp is later than now"))
|
||||
} else {
|
||||
Ok((timestamp.elapsed().as_secs_f64() as FLOAT).into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ mod time_functions {
|
||||
"Integer overflow for timestamp.elapsed: {}",
|
||||
seconds
|
||||
)))
|
||||
} else if *timestamp <= Instant::now() {
|
||||
} else if *timestamp > Instant::now() {
|
||||
Err(make_arithmetic_err("Time-stamp is later than now"))
|
||||
} else {
|
||||
Ok((seconds as INT).into())
|
||||
|
Reference in New Issue
Block a user