<commit_before>#include "StopWatch.h"
#include "TexCompTypes.h"

#include <stdlib.h>
#include <string.h>
#include <time.h>

class StopWatchImpl {
public:
  timespec ts;

  double timer;
  double duration;
};

StopWatch::StopWatch(const StopWatch &other) {
  impl = new StopWatchImpl();
  memcpy(impl, other.impl, sizeof(StopWatchImpl));
}

StopWatch &StopWatch::operator=(const StopWatch &other) {
  if(impl) {
    delete impl;
  }
  impl = new StopWatchImpl();
  memcpy(impl, other.impl, sizeof(StopWatchImpl));
}

StopWatch::~StopWatch() {
  delete impl;
}

StopWatch::StopWatch() : impl(new StopWatchImpl) {
  Reset();
}

void StopWatch::Start() {
  clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(impl->ts));
  impl->timer = double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec);
}

void StopWatch::Stop() {
  clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(impl->ts));
  impl->duration = -(impl->timer) + (double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec));
}
<commit_msg>Change unix clock to realtime<commit_after>#include "StopWatch.h"
#include "TexCompTypes.h"

#include <stdlib.h>
#include <string.h>
#include <time.h>

class StopWatchImpl {
public:
  timespec ts;

  double timer;
  double duration;
};

StopWatch::StopWatch(const StopWatch &other) {
  impl = new StopWatchImpl();
  memcpy(impl, other.impl, sizeof(StopWatchImpl));
}

StopWatch &StopWatch::operator=(const StopWatch &other) {
  if(impl) {
    delete impl;
  }
  impl = new StopWatchImpl();
  memcpy(impl, other.impl, sizeof(StopWatchImpl));
}

StopWatch::~StopWatch() {
  delete impl;
}

StopWatch::StopWatch() : impl(new StopWatchImpl) {
  Reset();
}

void StopWatch::Start() {
  clock_gettime(CLOCK_REALTIME, &(impl->ts));
  impl->timer = double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec);
}

void StopWatch::Stop() {
  clock_gettime(CLOCK_REALTIME, &(impl->ts));
  impl->duration = -(impl->timer) + (double(impl->ts.tv_sec) + 1e-9 * double(impl->ts.tv_nsec));
}

{'fraction_non_alphanumeric': 0.1712820512820513, 'fraction_numerical': 0.0041025641025641026, 'mean_word_length': 5.115987460815047, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, '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': '5907039', 'n_tokens_mistral': 733, 'n_tokens_neox': 724, 'n_words': 134}