-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time::Span#*, Time::Span#/ and Float #5272
Comments
@nome you are using crystal compiler version Both In |
@nome As a workaround you can use the done = 0.75 # 75% of work done
elapsed = Time::Span.new(0,1,0)
total = elapsed.total_seconds / done
pp total.seconds # => 00:01:20 |
/cc @asterite |
@petoem Thanks, the workaround does help. (incidentally, I've been using compiler and stdlib from the 0.24.0 pre-release tarball, so I disavow responsibility for any version mismatches ;-)) |
Trying to calculate an estimate of remaining time for a task based on elapsed time and percentage done, using the following code:
I see the following error:
Alternatively:
results in
So, neither
Time::Span#/
norTime::Span#*
appear to accept floats. However, the API documentation gives their types as#*(number : Number)
and#/(number : Number)
, and0.75.is_a? Number # => true
.Am I missing something or is this a bug?
The text was updated successfully, but these errors were encountered: