This was more of a problem with the earlier generation (early 2000's) of digital clocks. One of them had a fault which meant that if you gave it a bit of a smack then the battery might jiggle inside, momentarily interrupting the electricity supply and it would reset.
The post 2010 clocks don't have this problem, probably they just fitted a small capacitor to maintain current. Nevertheless most arbiters with more than a few years experience will be familiar with the problem and what to do, having probably handled the situation several times in the past.
The arbiter knows the start time, the current time, the increment and the current move number. From this he can work out how much game time is left. This remaining time is split equally between the two players, the clock adjusted appropriately and the game restarted.
Variations on this scenario can occur if the arbiter has recently had cause to write down the times of the clocks and thereby take into account different amounts of time taken, however this information has to be very fresh to be fair since somebody who was 5 minutes ahead on the clock quarter of an hour ago could easily be 5 minutes behind now.
If both players have been recording the time and have up to date time notations which match then these could be used. If only one player has such notations then they can only be used if both players agree.
If the clock is faulty it should be replaced and this entails a follow up rule for tournament organisers, that they should have several spare, working clocks with good batteries available.
Also worth noting that for more critical games the arbiter should move the players away from the board while sorting out the problem. Calculating the adjustments to be made and replacing the clock will take a couple of minutes and if the players are allowed to sit in front of the board then this could confer an unfair advantage in additional thinking time for one of the players.