anchor.diff:  %% @see //stdlib/gen_server:handle_info/2
   %% @private
   %%
  -handle_info(timeout, #state{rotate_time = Rotate, ipdr_dir = Directory,
  -		last_rotated_at = LastRotated} = State) ->
  -	FileName = Directory ++ "/" ++ ocs_log:iso8601(erlang:system_time(?MILLISECOND)),
  -	Now = calendar:local_time(),
  -	case ocs_log:ipdr_log(FileName, LastRotated, Now) of
  +handle_info(timeout, #state{interval = Interval, dir = Directory} = State) ->
  +	Time = erlang:system_time(?MILLISECOND),
  +	FileName = Directory ++ "/" ++ ocs_log:iso8601(Time),
  +	{Start, End} = previous(Interval),
  +	case ocs_log:ipdr_log(FileName, Start, End) of
   		ok ->
  -			{noreply, State#state{last_rotated_at = Now}, Rotate};
  +			{noreply, State, wait(Interval)};
   		{error, Reason} ->
  -			error_logger:error_report("Failed to create usage logs", [{module, ?MODULE},
  -				{failed_at, ocs_log:iso8601(erlang:system_time(?MILLISECOND))},
  -				{reason, Reason}]),
  -			{noreply, State#state{last_rotated_at = Now}, Rotate}
  +			error_logger:error_report("Failed to create log",
  +					[{module, ?MODULE}, {file, FileName}, {reason, Reason}]),
  +			{noreply, State, wait(Interval)}
   	end.
  -
  -
   
   -spec terminate(Reason, State) -> any()
   	when
  
positive.code: %% @see //stdlib/gen_server:init/1
  %% @private
  %%
  init([Rotate] = _Args) ->
  	process_flag(trap_exit, true),
  	{ok, Directory} = application:get_env(ipdr_dir),
  	State = #state{rotate_time = Rotate, ipdr_dir = Directory,
  			last_rotated_at = calendar:local_time()},
  	case file:make_dir(Directory) of
  		ok ->
  			{ok, State, 0};
  		{error, eexist} ->
  			{ok, State, 0};
  		{error, Reason} ->
  			{stop, Reason}
  	end.
  
negative.code: 			terminate/2, code_change/3]).
  
  -record(state,
  			{interval :: pos_integer(),
  			dir :: string()}).
  -type state() :: #state{}.
  
  %% support deprecated_time_unit()
  -define(MILLISECOND, milli_seconds).
  