<commit_before>
#include <ctime>
#ifdef _WIN32
#define NOMINMAX
#include <Windows.h>
#endif

#include <nstd/Time.h>

Time::Time(bool_t utc) : utc(utc)
{
  time_t now;
  ::time(&now);
  tm* tm = utc ? ::gmtime(&now) : ::localtime(&now);
  sec = tm->tm_sec;
  min = tm->tm_min;
  hour = tm->tm_hour;
  mday = tm->tm_mday;
  mon = tm->tm_mon;
  year = tm->tm_year;
  wday = tm->tm_wday;
  yday = tm->tm_yday;
  dst = !!tm->tm_isdst;
}

Time::Time(timestamp_t time, bool_t utc) : utc(utc)
{
  time_t now = (time_t)(time / 1000LL);
  tm* tm = utc ? ::gmtime(&now) : ::localtime(&now);
  sec = tm->tm_sec;
  min = tm->tm_min;
  hour = tm->tm_hour;
  mday = tm->tm_mday;
  mon = tm->tm_mon;
  year = tm->tm_year;
  wday = tm->tm_wday;
  yday = tm->tm_yday;
  dst = !!tm->tm_isdst;
}

Time::Time(const Time& other) :
  sec(other.sec),
  min(other.min),
  hour(other.hour),
  mday(other.mday),
  mon(other.mon),
  year(other.year),
  wday(other.wday),
  yday(other.yday),
  dst(other.dst),
  utc(other.utc) {}

timestamp_t Time::toTimestamp()
{
  tm tm;
  tm.tm_sec = sec;
  tm.tm_min = min;
  tm.tm_hour = hour;
  tm.tm_mday = mday;
  tm.tm_mon = mon;
  tm.tm_year = year;
  tm.tm_wday = wday;
  tm.tm_yday = yday;
  tm.tm_isdst = dst;
  if(utc)
#ifdef _WIN32
    return _mkgmtime(&tm) * 1000LL;
#else
    return timegm(&tm) * 1000LL;
#endif
  else
    return mktime(&tm) * 1000LL;<commit_msg>Time: Fix compilation error on cygwin<commit_after>
#include <ctime>
#ifdef _WIN32
#define NOMINMAX
#include <Windows.h>
#endif

#include <nstd/Time.h>

Time::Time(bool_t utc) : utc(utc)
{
  time_t now;
  ::time(&now);
  tm* tm = utc ? ::gmtime(&now) : ::localtime(&now);
  sec = tm->tm_sec;
  min = tm->tm_min;
  hour = tm->tm_hour;
  mday = tm->tm_mday;
  mon = tm->tm_mon;
  year = tm->tm_year;
  wday = tm->tm_wday;
  yday = tm->tm_yday;
  dst = !!tm->tm_isdst;
}

Time::Time(timestamp_t time, bool_t utc) : utc(utc)
{
  time_t now = (time_t)(time / 1000LL);
  tm* tm = utc ? ::gmtime(&now) : ::localtime(&now);
  sec = tm->tm_sec;
  min = tm->tm_min;
  hour = tm->tm_hour;
  mday = tm->tm_mday;
  mon = tm->tm_mon;
  year = tm->tm_year;
  wday = tm->tm_wday;
  yday = tm->tm_yday;
  dst = !!tm->tm_isdst;
}

Time::Time(const Time& other) :
  sec(other.sec),
  min(other.min),
  hour(other.hour),
  mday(other.mday),
  mon(other.mon),
  year(other.year),
  wday(other.wday),
  yday(other.yday),
  dst(other.dst),
  utc(other.utc) {}

timestamp_t Time::toTimestamp()
{
  tm tm;
  tm.tm_sec = sec;
  tm.tm_min = min;
  tm.tm_hour = hour;
  tm.tm_mday = mday;
  tm.tm_mon = mon;
  tm.tm_year = year;
  tm.tm_wday = wday;
  tm.tm_yday = yday;
  tm.tm_isdst = dst;
  if(utc)
#ifdef _MSC_VER
    return _mkgmtime(&tm) * 1000LL;
#else
    return timegm(&tm) * 1000LL;
#endif
  else
    return mktime(&tm) * 1000LL;
{'fraction_non_alphanumeric': 0.18419170243204577, 'fraction_numerical': 0.013590844062947067, 'mean_word_length': 3.3703125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 45, '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': '3250111', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1344, 'n_words': 250}