Get how many seconds change in time when receiving a TIME_SET broadcast

Is it possible to get the time before and after receiving a TIME_SET broadcast to compute its difference?


  1. Current time is 6:45
  2. Time change to 6:50
  3. TIME_SET triggers
  4. Get the difference of 5 mins

the class where to compute the difference:

public class TimeChangeReceiver extends BroadcastReceiver {

    public void onReceive(Context context, Intent intent) {
        if ("android.intent.action.TIME_SET".equals(intent.getAction()) || "android.intent.action.TIME_SET".equals(intent.getAction())) {
            //compute the difference

Sorry for my bad English :)