<commit_before>//*****************************************************************************
//
// Timer.cpp
//
// Class that offers timing capabilities.
//
// Copyright (c) 2015 <NAME>, <NAME>, and <NAME>
// This code is licensed under BSD license (see LICENSE.txt for details)
//
// Created:
// December 21, 2015
//
// Modified:
// December 28, 2015
//
//*****************************************************************************
#include "Timer.h"

#include <SDL.h>

//*****************************************************************************
//
//! Empty constructor for Timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
Timer::Timer()
    : _startTime(0), _tempTime(0), _pausedTime(0), _started(false),
      _paused(false)
{

}

//*****************************************************************************
//
//! Empty destructor for Timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
Timer::~Timer()
{

}

//*****************************************************************************
//
//! Starts timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::start()
{
    if (!_started)
    {
        _startTime = SDL_GetTicks();
        _tempTime = _startTime;
        _pausedTime = 0;
        _started = false;
        _paused = false;
    }
}

//*****************************************************************************
//
//! Stops timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::stop()
{
    if (_started)
    {
        _startTime = 0;
        _tempTime = 0;
        _pausedTime = 0;
        _started = false;
        _paused = false;
    }
}

//*****************************************************************************
//
//! Pauses timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::pause()
{
    if (_started)
    {
        if (!_paused)
        {
            _pausedTime = getTimeOnTimer();
            _paused = true;
        }
    }
}

//*****************************************************************************
//
//! Resumes timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::resume()
{
    if (_started)
    {
        if (_paused)
        {
            _tempTime = SDL_GetTicks() - _pausedTime;
            _pausedTime = 0;
            _paused = false;
        }
    }
}

//*****************************************************************************
//
//! Gets the current time on the timer.
//!
//! \param None.
//!
//! \return Returns the current time on the timer.
//
//*****************************************************************************
unsigned int Timer::getTimeOnTimer()
{
    if (_started)
    {
        if (_paused)
        {
            return _pausedTime;
        }
        else
        {
            return SDL_GetTicks() - _tempTime;
        }
    }
    else
    {
        return 0;
    }
}

//*****************************************************************************
//
//! Gets the time since the timer started.
//!
//! \param None.
//!
//! \return Returns the time since the timer started.
//
//*****************************************************************************
unsigned int Timer::getTimeSinceTimerStarted()
{
    if (_started)
    {
        return SDL_GetTicks() - _startTime;
    }
    else
    {
        return 0;
    }
}

//*****************************************************************************
//
//! Checks if the timer has been started.
//!
//! \param None.
//!
//! \return Returns \b true if the timer has been started and \b false if the
//! timer has not been started.
//
//*****************************************************************************
bool Timer::isStarted()
{
    return _started;
}

//*****************************************************************************
//
//! Checks if the timer has been paused.
//!
//! \param None.
//!
//! \return Returns \b true if the timer has been paused and \b false if the
//! timer has not been paused.
//
//*****************************************************************************
bool Timer::isPaused()
{
    return _paused;
}
<commit_msg>Fixed bug in Timer class causing timer to not start properly.<commit_after>//*****************************************************************************
//
// Timer.cpp
//
// Class that offers timing capabilities.
//
// Copyright (c) 2015 <NAME>, <NAME>, and <NAME>
// This code is licensed under BSD license (see LICENSE.txt for details)
//
// Created:
// December 21, 2015
//
// Modified:
// February 24, 2016
//
//*****************************************************************************
#include "Timer.h"

#include <SDL.h>

//*****************************************************************************
//
//! Empty constructor for Timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
Timer::Timer()
    : _startTime(0), _tempTime(0), _pausedTime(0), _started(false),
      _paused(false)
{

}

//*****************************************************************************
//
//! Empty destructor for Timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
Timer::~Timer()
{

}

//*****************************************************************************
//
//! Starts timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::start()
{
    if (!_started)
    {
        _startTime = SDL_GetTicks();
        _tempTime = _startTime;
        _pausedTime = 0;
        _started = true;
        _paused = false;
    }
}

//*****************************************************************************
//
//! Stops timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::stop()
{
    if (_started)
    {
        _startTime = 0;
        _tempTime = 0;
        _pausedTime = 0;
        _started = false;
        _paused = false;
    }
}

//*****************************************************************************
//
//! Pauses timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::pause()
{
    if (_started)
    {
        if (!_paused)
        {
            _pausedTime = getTimeOnTimer();
            _paused = true;
        }
    }
}

//*****************************************************************************
//
//! Resumes timer.
//!
//! \param None.
//!
//! \return None.
//
//*****************************************************************************
void Timer::resume()
{
    if (_started)
    {
        if (_paused)
        {
            _tempTime = SDL_GetTicks() - _pausedTime;
            _pausedTime = 0;
            _paused = false;
        }
    }
}

//*****************************************************************************
//
//! Gets the current time on the timer.
//!
//! \param None.
//!
//! \return Returns the current time on the timer.
//
//*****************************************************************************
unsigned int Timer::getTimeOnTimer()
{
    if (_started)
    {
        if (_paused)
        {
            return _pausedTime;
        }
        else
        {
            return SDL_GetTicks() - _tempTime;
        }
    }
    else
    {
        return 0;
    }
}

//*****************************************************************************
//
//! Gets the time since the timer started.
//!
//! \param None.
//!
//! \return Returns the time since the timer started.
//
//*****************************************************************************
unsigned int Timer::getTimeSinceTimerStarted()
{
    if (_started)
    {
        return SDL_GetTicks() - _startTime;
    }
    else
    {
        return 0;
    }
}

//*****************************************************************************
//
//! Checks if the timer has been started.
//!
//! \param None.
//!
//! \return Returns \b true if the timer has been started and \b false if the
//! timer has not been started.
//
//*****************************************************************************
bool Timer::isStarted()
{
    return _started;
}

//*****************************************************************************
//
//! Checks if the timer has been paused.
//!
//! \param None.
//!
//! \return Returns \b true if the timer has been paused and \b false if the
//! timer has not been paused.
//
//*****************************************************************************
bool Timer::isPaused()
{
    return _paused;
}

{'fraction_non_alphanumeric': 0.4851701871511437, 'fraction_numerical': 0.005691145890335997, 'mean_word_length': 3.054125998225377, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1273102', 'n_tokens_mistral': 2486, 'n_tokens_neox': 2070, 'n_words': 534}