anchor.diff:      terminate(normal, State);
   connected(check_keepalive, #state{last_time_active=Last, keep_alive=KeepAlive} = State) ->
       Now = os:timestamp(),
  -    case (timer:now_diff(Now, Last) div 1000) > KeepAlive of
  +    case (timer:now_diff(Now, Last) div 1000000) > KeepAlive of
           true ->
  -            lager:warning("[~p] stop due to keepalive expired~n", [self()]),
  +            lager:warning("[~p] stop due to keepalive expired", [self()]),
               terminate(normal, State);
           false ->
               set_keepalive_timer(KeepAlive),
  
positive.code:         {error, Reason} ->
              {error, Reason, serialise(OutAcc)};
          {Frame, Rest} ->
              case in(Frame, SessionState) of
                  {stop, Reason, Out} ->
                      {stop, Reason, serialise([Out|OutAcc])};
                  {NewSessionState, {throttle, Out}} ->
  
negative.code:     end.
  
  msg_in(Msg, SessionState) ->
     case in(Msg, SessionState, false) of
         {stop, Reason, Out} ->
             {stop, Reason, serialise([Out])};
         {NewSessionState, {throttle, Out}} ->
  