<commit_before>package com.genuitec.piplug.app.clock;

import java.util.Calendar;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;

public class ClockJob extends Job implements Runnable {

    private boolean running = true;
    private ClockComposite composite;

    public ClockJob(ClockComposite composite) {
	super("clock");
	this.composite = composite;
    }

    @Override
    protected IStatus run(IProgressMonitor monitor) {
	Display.getDefault().syncExec(this);
	if (running) {
	    Calendar cal = Calendar.getInstance();
	    int milli = cal.get(Calendar.MILLISECOND);
	    schedule(1000 - milli);
	}
	return Status.OK_STATUS;
    }

    public void stop() {
	running = false;
    }

    public void run() {
	if (composite.isDisposed()) {
	    running = false;
	    return;
	}
	composite.updateTime();
    }
}<commit_msg>Avoid creating new object each second<commit_after>package com.genuitec.piplug.app.clock;

import java.util.Calendar;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;

public class ClockJob extends Job implements Runnable {

    private boolean running = true;
    private ClockComposite composite;
    private Calendar calendar;

    public ClockJob(ClockComposite composite) {
	super("clock");
	this.composite = composite;
	this.calendar = Calendar.getInstance();
    }

    @Override
    protected IStatus run(IProgressMonitor monitor) {
	Display.getDefault().syncExec(this);
	if (running) {
	    calendar.setTimeInMillis(System.currentTimeMillis());
	    int milli = calendar.get(Calendar.MILLISECOND);
	    schedule(1000 - milli);
	}
	return Status.OK_STATUS;
    }

    public void stop() {
	running = false;
    }

    public void run() {
	if (composite.isDisposed()) {
	    running = false;
	    return;
	}
	composite.updateTime();
    }
}
{'fraction_non_alphanumeric': 0.10958254269449716, 'fraction_numerical': 0.003795066413662239, 'mean_word_length': 3.8260869565217392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5566023', 'n_tokens_mistral': 679, 'n_tokens_neox': 639, 'n_words': 140}