aboutsummaryrefslogtreecommitdiff
path: root/seq-read.c
blob: 90d201fa108c1a8716952fb7fdcf2afd5bff56c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int
main(void)
{
	clock_t start = clock();
	size_t sum = 0;

	for ( int ch; (ch = getc(stdin)) != EOF; ) {
		sum += (unsigned char) ch;
	}

	clock_t end = clock();

	printf("Result: %zu, Duration: %.3lf sec\n", sum, ((double)(end - start)) / CLOCKS_PER_SEC);

	return EXIT_SUCCESS;
}