anchor.diff:  
   handle_cast(_Request, State) ->
       {noreply, State}.
  -
  -timestamp({Mega, Secs, Micro}) -> Mega*1000000000000 + Secs*1000000 + Micro.
   
   handle_info(snapshot, #state{snap_interval = SnapInterval, snapdir=SnapDir} = State) ->
       case filelib:is_dir(SnapDir) of
  
positive.code:     end,
      mnesia:subscribe(system),
      ?Log("~p started as ~p!~n", [?MODULE, NodeType]),
      if SnapInterval > 0 -> erlang:send_after(SnapInterval, self(), snapshot); true -> ok end,
      {_, SnapDir} = application:get_env(imem, imem_snapshot_dir),
      SnapshotDir = filename:absname(SnapDir),
  
negative.code:     end,
      Tabs = [T || T <- mnesia:system_info(tables), re:run(atom_to_list(T), "(.*@.*)|schema") =:= nomatch],
      [(fun() ->
          case ets:lookup(?MODULE, T) of
              [] -> ok;
              [#user_properties { table = T, last_write = Wt, last_snap = St} = Up | _] ->
                  LastWriteTime = timestamp(Wt),
                  LastSnapTime = timestamp(St),
                  if 
                      LastSnapTime < LastWriteTime ->
                          %if T =:= ddTable -> io:format(user, "snap ~p timestamps ~p ~p~n", [T, {LastWriteTime, LastSnapTime}, {Wt, St}]); true -> ok end,
                          mnesia:transaction(fun() ->
                                          Rows = mnesia:select(T, [{'$1', [], ['$1']}], write),
                                          BackFile = filename:join([SnapDir, atom_to_list(T)++".bkp"]),
                                          NewBackFile = filename:join([SnapDir, atom_to_list(T)++".bkp.new"]),
                                          ok = file:write_file(NewBackFile, term_to_binary(Rows)),
                                          {ok, _} = file:copy(NewBackFile, BackFile),
                                          ?Log("snap ~p -> ~p~n", [T, BackFile]),
                                          ok = file:delete(NewBackFile)
                                         end),
                          true = ets:insert(?MODULE, Up#user_properties{last_snap = erlang:now()});
                      true -> 
                          %if T =:= ddTable -> io:format(user, "nosnap ~p timestamps ~p ~p~n", [T, {LastWriteTime, LastSnapTime}, {Wt, St}]); true -> ok end,
                          ok % no backup needed
                  end
          end
        end)()
      || T <- Tabs],
  