anchor.diff:      {MegaSecs, Secs, MicroSecs} = os:timestamp(),
       MegaSecs * 1000000000 + Secs * 1000 + MicroSecs div 1000.
   
  --spec time_of_next_iteration(#const_rate{} | #linear_rate{}, number(), integer())
  +-spec time_of_next_iteration(#const_rate{} | #linear_rate{}, number(), float())
       -> number().
   time_of_next_iteration(#const_rate{value = undefined}, _, _) -> 0;
   time_of_next_iteration(#const_rate{value = 0}, Duration, _) -> Duration * 2; % should be more than loop length "2" does not stand for anything important
  
positive.code:             {Prev, _} -> Done;
              {undefined, _} -> Done;
              {New, 0} -> round(New * CurTime / 1000);
              {New, undefined} -> round(New * CurTime / 1000);
              {New, _} -> round(New * CurTime / 1000)
          end,
      {RateState#const_rate{value = Rate}, NewDone, State1};
  
negative.code:     end.
  
  looprun(TimeFun, Rate, Body, WorkerProvider, State, Env, Opts = #opts{parallel = 1})  ->
      timerun(msnow(), random:uniform(), TimeFun, Rate, Body, WorkerProvider, Env, true, Opts, 1, State, 0);
  looprun(TimeFun, Rate, Body, WorkerProvider, State, Env, Opts = #opts{parallel = N}) ->
      StartTime = msnow(),
      _ = mzb_lists:pmap(fun (I) ->
          _ = random:seed(now()),
          timerun(StartTime, random:uniform(), TimeFun, Rate, Body, WorkerProvider, Env, true, Opts, 1, State, I)
      end, lists:seq(0, N - 1)),
      {nil, State}.
  
  timerun(Start, Shift, TimeFun, Rate, Body, WorkerProvider, Env, IsFirst, Opts, Batch, State, OldDone) ->
      LocalTime = msnow() - Start,
      {Time, State1} = TimeFun(State),
      {NewRate, Done, State2} = eval_rates(Rate, OldDone, LocalTime, Time, State1),
      ShouldBe = time_of_next_iteration(NewRate, Time, Done + Shift),
  
      Remain = round(ShouldBe) - LocalTime,
      GotTime = round(Time) - LocalTime,
  