<commit_before>// Globals
// Grabs the id's for digits
var hour = document.getElementById('hours'),
    minutes = document.getElementById('minutes'),
    seconds = document.getElementById('seconds'),
    miliseconds = document.getElementById('miliseconds'),

// Grabs the id's for the buttons
    startButton = document.getElementById('startButton'),
    pauseButton =  document.getElementById('pauseButton'),
    stopButton = document.getElementById('stopButton'),
    resetButton = document.getElementById('resetbutton'),

    setTime,
    currentTime,
    difference,
    timer = 0,
    interval;

// Gets current time and sets the interval
var start = function() {
  setTime = Date.now();
  interval = setInterval(update, 10);
};

// This cancel the setInterval when called
var pause = function() {
  clearInterval(interval);
};

// This cancels & sets the timer to 0
var stop = function() {
  clearInterval(interval);
  timer = 0;
};

// This sets timer to 0 then calls updateScreen() to show a new time
var reset = function() {
  timer = 0;
  updateScreen();
};

// Updates the current time
var update = function() {
  currentTime = Date.now();
  difference = currentTime - setTime;
  timer += difference;

  updateScreen();
  setTime = currentTime;
};

// Sets all digit value to be double digits even when under 10
var doubleDigit = function(num) {
  var numString = num.toString();

  if (numString.length < 2) {
    return '0' + numString;
  } else {
    return numString;
  }
};

// Converts the current time to miliseconds
var updateScreen = function() {
  var time = timer/1000,
      timeMiliSeconds = parseInt((time % 1) * 100);
      timeSeconds = Math.floor(time);
      timeMinutes = Math.floor(timeSeconds/60);
      timeHours = Math.floor(timeMinutes/60);

  miliseconds.innerText = doubleDigit(timeMiliSeconds);
  seconds.innerText = doubleDigit(timeSeconds);
  minutes.innerText = doubleDigit(timeMinutes);
  hours.innerText = doubleDigit(timeHours);
};

// Fires the start() when the #startButton is clicked
startButton.addEventListener('click', start);
// Fires the pause() when the #pauseButton is clicked
pauseButton.addEventListener('click', pause);
// Fires the stop() when the #stopButton is clicked
stopButton.addEventListener('click', stop);
// Fires the reset() when the #stopButton is clicked
resetButton1.addEventListener('click', reset);<commit_msg>set limit to sixty for minutes and hours<commit_after>// Globals
// Grabs the id's for digits
var hour = document.getElementById('hours'),
    minutes = document.getElementById('minutes'),
    seconds = document.getElementById('seconds'),
    miliseconds = document.getElementById('miliseconds'),

// Grabs the id's for the buttons
    startButton = document.getElementById('startButton'),
    pauseButton =  document.getElementById('pauseButton'),
    stopButton = document.getElementById('stopButton'),
    resetButton = document.getElementById('resetbutton'),

    setTime,
    currentTime,
    difference,
    timer = 0,
    interval;

// Gets current time and sets the interval
var start = function() {
  setTime = Date.now();
  interval = setInterval(update, 10);
};

// This cancel the setInterval when called
var pause = function() {
  clearInterval(interval);
};

// This cancels & sets the timer to 0
var stop = function() {
  clearInterval(interval);
  timer = 0;
};

// This sets timer to 0 then calls updateScreen() to show a new time
var reset = function() {
  timer = 0;
  updateScreen();
};

// Updates the current time
var update = function() {
  currentTime = Date.now();
  difference = currentTime - setTime;
  timer += difference;

  updateScreen();
  setTime = currentTime;
};

// Sets all digit value to be double digits even when under 10
var doubleDigit = function(num) {
  var numString = num.toString();

  if (numString.length < 2) {
    return '0' + numString;
  } else {
    return numString;
  }
};

// When the number is gets over 60 the digits place will star over a 00
var limitAtSixty = function(num) {
  var newNum = Math.floor(num/60);
  if (num/60 >= newNum) {
    return num - 60 * newNum;
  }
};

// Converts the current time to miliseconds
var updateScreen = function() {
  var time = timer/1000,
      timeMiliSeconds = parseInt((time % 1) * 100);
      timeSeconds = Math.floor(time);
      timeMinutes = Math.floor(timeSeconds/60);
      timeHours = Math.floor(timeMinutes/60);

  miliseconds.innerText = doubleDigit(timeMiliSeconds);
  seconds.innerText = doubleDigit(limitAtSixty(timeSeconds));
  minutes.innerText = doubleDigit(limitAtSixty(timeMinutes));
  hours.innerText = doubleDigit(timeHours);
};

// Fires the start() when the #startButton is clicked
startButton.addEventListener('click', start);
// Fires the pause() when the #pauseButton is clicked
pauseButton.addEventListener('click', pause);
// Fires the stop() when the #stopButton is clicked
stopButton.addEventListener('click', stop);
// Fires the reset() when the #stopButton is clicked
resetButton1.addEventListener('click', reset);
{'fraction_non_alphanumeric': 0.11891032014316961, 'fraction_numerical': 0.011533107973752238, 'mean_word_length': 4.035035035035035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '4946900', 'n_tokens_mistral': 1481, 'n_tokens_neox': 1410, 'n_words': 448}