<commit_before>// Copyright (c) 2014, <NAME> (Sudiukil) <<EMAIL>>
// File under the terms of the ISC license, see LICENSE (or http://opensource.org/licenses/ISC) for complete copy.

#include <stdio.h>
#include <unistd.h>

#include "src/general.h"
#include "src/display.h"

#include "src/time.h"

int main(int argc, char *argv[]) {

    char *str_data;

    printf("{\"version\":1}\n");
    printf("[[],\n");

    while(1) {
	sleep(1);
	fflush(stdout);
	printf("[\n");

	str_data = get_time("%d/%m/%Y - %H:%M:%S");
	display(
		"time",
		"local",
		NULL,
		str_data,
		NULL,
		NULL,	
		0,
		1
	       );
	free(str_data);

	printf("],\n");
    }

    return 0;
}<commit_msg>Optimization of waiting time for main loop<commit_after>// Copyright (c) 2014, <NAME> (Sudiukil) <<EMAIL>>
// File under the terms of the ISC license, see LICENSE (or http://opensource.org/licenses/ISC) for complete copy.

#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>

#include "all.h"
#include "config.h"

int main(int argc, char *argv[]) {

	struct timeval t1, t2;
	float elapsed_time;
	int refresh_interval;

	if(argc>1 && argv[1]!=NULL) {
		sscanf(argv[1], "%d", &refresh_interval);
		refresh_interval = refresh_interval*1000;
	}
	else refresh_interval = 1000;

	printf("{\"version\":1}\n");
	printf("[[],\n");

	conf();

	while(1) {
		gettimeofday(&t1, NULL);

		fflush(stdout);
		printf("[\n");

		update();

		printf("{\"full_text\":\"\"}");

		printf("],\n");

		gettimeofday(&t2, NULL);
		elapsed_time = ((t2.tv_sec-t1.tv_sec)*1000)+((t2.tv_usec-t1.tv_usec)/1000);
		if(elapsed_time<refresh_interval) usleep((refresh_interval-elapsed_time)*1000);
	}

	return 0;
}
{'fraction_non_alphanumeric': 0.20433996383363473, 'fraction_numerical': 0.028933092224231464, 'mean_word_length': 3.970059880239521, 'pattern_counts': {'":': 3, '<': 15, '<?xml version=': 0, '>': 15, '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': '440611', 'n_tokens_mistral': 727, 'n_tokens_neox': 653, 'n_words': 141}