<commit_before>#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <termbox.h>

static int get_current_time(char *buff) {
	time_t current_time = time(NULL);

	if(strftime(buff, 10, "%H:%M:%S", localtime(&current_time)))
		return 0;
	else
		return 1;
}

static void draw_line_clock(char *buff) {
	int x, y, i;
	tb_clear();
	x = (tb_width()/2)-5;
	y = tb_height()/2;
	for(i=0;i<10;i++){
		tb_change_cell(x + i, y, buff[i], TB_WHITE, TB_DEFAULT);
	}
	
}

int main(void) {
	char buff[75];
	int ret, q=1;
	struct tb_event ev;
	ret = tb_init();
	if(ret){
		fprintf(stderr, "tb_init() failed with error code %d\n", ret);
		return 1;
	}
	while(q) {
		tb_peek_event(&ev, 1);
		tb_clear();
		switch(ev.type) {
		case TB_EVENT_KEY:
			switch(ev.key) {
			case TB_KEY_ESC:
				q = 0;
				break;
			}
		default:
			get_current_time(buff);
			draw_line_clock(buff);
			tb_present();
			sleep(1);
			break;
		}
	}
	tb_shutdown();<commit_msg>change escape key to 'q'<commit_after>#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <termbox.h>

static 
int get_current_time(char *buff) {
	time_t current_time = time(NULL);

	if(strftime(buff, 10, "%H:%M:%S", localtime(&current_time)))
		return 0;
	else
		return 1;
}

static 
void draw_line_clock(char *buff) {
	int x, y, i;
	tb_clear();
	x = (tb_width()/2)-5;
	y = tb_height()/2;
	for(i=0;i<10;i++){
		tb_change_cell(x + i, y, buff[i], TB_BLACK, TB_DEFAULT);
	}
	
}

int main(void) {
	char buff[8];
	int ret, q=1;
	struct tb_event ev;
	ret = tb_init();
	if(ret){
		fprintf(stderr, "tb_init() failed with error code %d\n", ret);
		return 1;
	}
	while(q) {
		switch(ev.type) {
		case TB_EVENT_KEY:
			if(ev.ch=='q') {
				q = 0;
			}
		default:
			get_current_time(buff);
			draw_line_clock(buff);
			tb_present();
			break;
		}
		tb_peek_event(&ev, 100);
		tb_clear();
	}
	tb_shutdown();
{'fraction_non_alphanumeric': 0.17891891891891892, 'fraction_numerical': 0.018378378378378378, 'mean_word_length': 3.8839050131926123, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '2908198', 'n_tokens_mistral': 921, 'n_tokens_neox': 828, 'n_words': 173}