<commit_before>#ifndef _TimeClass_H_
#define _TimeClass_H_

#include "condor_debug.h"
#if !defined(WIN32)
#include <sys/time.h>
#endif

static char *_FileName_ = __FILE__;

class Time {

private:

  long Sec;
  long MicroSec;

public:

  Time(long S=0, long MS=0) { Sec=S; MicroSec=MS; }
  Time(const Time& T) { Sec=T.Sec; MicroSec=T.MicroSec; }

  Time& operator=(const Time& T) {
    Sec=T.Sec;
    MicroSec=T.MicroSec;
    return *this;
  }

  int operator==(const Time& T) const { return (Sec==T.Sec && MicroSec==T.MicroSec); }
  int operator<(const Time& T) const { return (Sec==T.Sec ? MicroSec<T.MicroSec : Sec<T.Sec); }
  int operator<=(const Time& T) const { return (Sec==T.Sec ? MicroSec<=T.MicroSec : Sec<T.Sec); }
  int operator>(const Time& T) const { return (Sec==T.Sec ? MicroSec>T.MicroSec : Sec>T.Sec); }
  int operator>=(const Time& T) const { return (Sec==T.Sec ? MicroSec>=T.MicroSec : Sec>T.Sec); }
  
  static Time Now() {
#if defined(WIN32)
	  return Time(time(NULL), 0);
#else
    struct timeval tp;
    if (gettimeofday(&tp,NULL)==-1) {
      EXCEPT ("gettimeofday()");
    }
    return Time(tp.tv_sec,tp.tv_usec);
#endif
  }

  static double DiffTime(Time From, Time To) {
    return double(To.Sec-From.Sec)+double(To.MicroSec-From.MicroSec)/1000000;
  }

  friend ostream& operator<<(ostream& os, const Time& T) {
    os << T.Sec << ' ' << T.MicroSec;
    return os;
  }

  friend istream& operator>>(istream& is, Time& T) {
    long l;
    is >> l;
    T.Sec=l;
    is >> l;
    T.MicroSec=l;
    return is;
  }

};

#endif<commit_msg>Changed Time class to use double as internal data format. This simplifies calculationg differences between times, and saving to file.<commit_after>#ifndef _TimeClass_H_
#define _TimeClass_H_

#include "condor_debug.h"
#if !defined(WIN32)
#include <sys/time.h>
#endif

static char *_FileName_ = __FILE__;

class Time {

private:

  double Sec;

public:

  Time(double d=0) { Sec=d; }
  Time(const Time& T) { Sec=T.Sec; }

  Time& operator=(const Time& T) {
    Sec=T.Sec;
    return *this;
  }

  int operator==(const Time& T) const { return (Sec==T.Sec); }
  int operator<(const Time& T) const { return (Sec<T.Sec); }
  int operator<=(const Time& T) const { return (Sec<=T.Sec); }
  int operator>(const Time& T) const { return (Sec>T.Sec); }
  int operator>=(const Time& T) const { return (Sec>=T.Sec); }
  
  static Time Now() {
#if defined(WIN32)
	  return Time(time(NULL));
#else
    struct timeval tp;
    if (gettimeofday(&tp,NULL)==-1) {
      EXCEPT ("gettimeofday()");
    }
    double d=((double)tp.tv_sec)+((double)tp.tv_usec)/1000000;
    return Time(d);
#endif
  }

/*
  friend Time operator-(const Time& T1, const Time& T2) {
    return Time(T1.Sec-T2.Sec);
  }

  friend ostream& operator<<(ostream& os, const Time& T) {
    double d=T.Sec;
    os << d;
    return os;
  }

  friend istream& operator>>(istream& is, Time& T) {
    double d;
    is >> d;
    T.Sec=d;
    return is;
  }
*/

  operator double() const { return Sec; }

};

#endif
{'fraction_non_alphanumeric': 0.1632450331125828, 'fraction_numerical': 0.010596026490066225, 'mean_word_length': 3.4166666666666665, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, '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': '6623148', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1145, 'n_words': 292}