Why is this valued zeroed?

Ali Çehreli acehreli at yahoo.com
Thu Jan 11 22:07:18 UTC 2018


On 01/11/2018 12:21 PM, Marc wrote:
 > I stuck at this and can't figure out the reason why the value of the
 > variable ds is 0 when I do this: startTime = MonoTime.currTime;

It's not clear which of the two statements you're talking about.
 >>     http.onProgress = (size_t dltotal, size_t dlnow,
 >>                        size_t ultotal, size_t ulnow) {
 >>         if(dlNow > 0) {
 >>            MonoTime endTime = MonoTime.currTime;
 >>            Duration duration = endTime - startTime;
 >>         long ds = duration.total!"seconds";
 >>         writeln("duration!seconds  = ", ds);
 >>         startTime = MonoTime.currTime;

I would remove the one above and keep the one below.

 >>     startTime = MonoTime.currTime;
 >>     http.perform();

If you're trying to measure time between two onProgress() calls, as 
Steve noted, seconds is probably too large a unit.

Ali



More information about the Digitalmars-d-learn mailing list