<commit_before>#include <stddef.h>
#include <time.h>
#include <pthread.h>
#include <stdlib.h>
#include "timers.h"

struct timer_data_t {
    long millis;
    timer_callback_t timer_callback;
    void* data;
};

void *timer_thread(void *data) {

    struct timer_data_t *timer_data = data;

    struct timespec t;
    t.tv_sec = 0;
    t.tv_nsec = 1000 * 1000 * timer_data->millis;
    nanosleep(&t, NULL);
    timer_data->timer_callback(timer_data->data);

    free(data);

    return NULL;
}

void start_timer(long millis, timer_callback_t timer_callback, void *data) {

    struct timer_data_t *timer_data = malloc(sizeof(struct timer_data_t));
    timer_data->millis = millis;
    timer_data->timer_callback = timer_callback;
    timer_data->data = data;<commit_msg>Fix bug for timers longer than 1 second<commit_after>#include <stddef.h>
#include <time.h>
#include <pthread.h>
#include <stdlib.h>
#include "timers.h"

struct timer_data_t {
    long millis;
    timer_callback_t timer_callback;
    void* data;
};

void *timer_thread(void *data) {

    struct timer_data_t *timer_data = data;

    struct timespec t;
    t.tv_sec = timer_data->millis / 1000;
    t.tv_nsec = 1000 * 1000 * (timer_data->millis % 1000);
    nanosleep(&t, NULL);
    timer_data->timer_callback(timer_data->data);

    free(data);

    return NULL;
}

void start_timer(long millis, timer_callback_t timer_callback, void *data) {

    struct timer_data_t *timer_data = malloc(sizeof(struct timer_data_t));
    timer_data->millis = millis;
    timer_data->timer_callback = timer_callback;
    timer_data->data = data;
{'fraction_non_alphanumeric': 0.11772072636192861, 'fraction_numerical': 0.01628052598622417, 'mean_word_length': 4.0251572327044025, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 24, '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': '5065634', 'n_tokens_mistral': 605, 'n_tokens_neox': 563, 'n_words': 124}