<commit_before>#include "NFCUUIDModule.h"
#include "NFComm/NFPluginModule/NFIKernelModule.h"
#include "NFComm/NFPluginModule/NFIPluginManager.h"

namespace UUIDModule
{

#ifndef _MSC_VER
#include <sys/time.h>
#include <unistd.h>
#define EPOCHFILETIME 11644473600000000ULL
#else
#include <windows.h>
#include <time.h>
#define EPOCHFILETIME 11644473600000000Ui64
#endif

uint64_t get_time()
{
#ifndef _MSC_VER
    struct timeval tv;
    gettimeofday(&tv, NULL);
    int time = tv.tv_usec;
    time /= 1000;
    time += (tv.tv_sec * 1000);
    return time;
#else
    FILETIME filetime;
    uint64_t time = 0;
    GetSystemTimeAsFileTime(&filetime);

    time |= filetime.dwHighDateTime;
    time <<= 32;
    time |= filetime.dwLowDateTime;

    time /= 10;
    time -= EPOCHFILETIME;
    return time / 1000;
#endif
}

class UUID
{
public:
    UUID() : epoch_(0), time_(0), machine_(0), sequence_(0)
    {
    }

    ~UUID() {}

    void set_epoch(uint64_t epoch)
    {
        epoch_ = epoch;
    }

    void set_machine(int32_t machine)
    {
        machine_ = machine;
    }

    int64_t generate()
    {
        int64_t value = 0;
        uint64_t time = UUIDModule::get_time() - epoch_;

        // 保留后48位时间
        value = time << 16;

        // 最后16位是sequenceID
        value |= sequence_++ & 0xFFFF;

        if (sequence_ == 0xFFFF)
        {
            sequence_ = 0;
        }

        return value;
    }
private:
    uint64_t epoch_;
    uint64_t time_;
    int32_t machine_;
    int32_t sequence_;
};
}
<commit_msg>modify uuid generate<commit_after>#include "NFCUUIDModule.h"
#include "NFComm/NFPluginModule/NFIKernelModule.h"
#include "NFComm/NFPluginModule/NFIPluginManager.h"

namespace UUIDModule
{

#ifndef _MSC_VER
#include <sys/time.h>
#include <unistd.h>
#define EPOCHFILETIME 11644473600000000ULL
#else
#include <windows.h>
#include <time.h>
#define EPOCHFILETIME 11644473600000000Ui64
#endif

uint64_t get_time()
{
#ifndef _MSC_VER
    struct timeval tv;
    gettimeofday(&tv, NULL);
    int time = tv.tv_usec;
    time /= 1000;
    time += (tv.tv_sec * 1000);
    return time;
#else
    FILETIME filetime;
    uint64_t time = 0;
    GetSystemTimeAsFileTime(&filetime);

    time |= filetime.dwHighDateTime;
    time <<= 32;
    time |= filetime.dwLowDateTime;

    time /= 10;
    time -= EPOCHFILETIME;
    return time / 1000;
#endif
}

class UUID
{
public:
    UUID() : epoch_(0), time_(0), machine_(0), sequence_(0)
    {
    }

    ~UUID() {}

    void set_epoch(uint64_t epoch)
    {
        epoch_ = epoch;
    }

    void set_machine(int32_t machine)
    {
        machine_ = machine;
    }

    int64_t generate()
    {
        int64_t value = 0;
        uint64_t time = UUIDModule::get_time() - epoch_;

        // 保留后48位时间
        value = time << 16;

        // 最后16位是sequenceID
        //value |= sequence_++ & 0xFFFF;

        if (sequence_ == 0x7FFF)
        {
            sequence_ = 0;
        }

        return value + sequence_;
    }
private:
    uint64_t epoch_;
    uint64_t time_;
    int32_t machine_;
    int32_t sequence_;
};
}

{'fraction_non_alphanumeric': 0.11472213194670133, 'fraction_numerical': 0.05817354566135847, 'mean_word_length': 2.509692132269099, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '7585436', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1130, 'n_words': 239}