Why is this valued zeroed?

Marc jckj33 at gmail.com
Fri Jan 12 20:00:08 UTC 2018


On Friday, 12 January 2018 at 05:14:12 UTC, Jonathan M Davis 
wrote:
> On Thursday, January 11, 2018 14:07:18 Ali Çehreli via 
> Digitalmars-d-learn wrote:
>> [...]
>
> And if all what you're doing is printing the value out, you 
> might as well just print the Duration directly rather than 
> calling total. Duration.toString returns the units in a 
> human-readable format such as "2 secs, 300 msecs, and 24 μs" or 
> "29 msecs".
>
> https://dlang.org/phobos/core_time.html#.Duration.toString
>
> And if you're doing something like adding up the time spent, 
> then you'd be better off keeping it in a Duration than 
> converting it to long holding seconds or milliseconds or 
> whatever.
>
> - Jonathan M Davis

I do use that value as following:

> int t = fileSize / countOfByetsDownloaded * 
> duration.total!"seconds";

I print that value there for testing only, if I was getting the 
values correctly.

Thank you all guys for the answers.



More information about the Digitalmars-d-learn mailing list