X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=simple_time.c;h=0055e1c968051aaccdb041980cb9b66f13861d4c;hb=ef5d2578315c704cc7fb722ae4dedf1d41ee4239;hp=eea422f497ef08dc0273739d7f607226813ef493;hpb=d3b13f018be93d91da13ec029769be24280a319a;p=cmccabe-bin diff --git a/simple_time.c b/simple_time.c index eea422f..0055e1c 100644 --- a/simple_time.c +++ b/simple_time.c @@ -1,6 +1,9 @@ +#define _POSIX_PTHREAD_SEMANTICS // needed for Solaris for asctime_r + #include #include #include +#include /* Prints a time on a single line of the console. * I wrote this app so that I could measure times by repeatedly pressing @@ -23,13 +26,11 @@ int main(void) { while (1) { char str[27]; - size_t i, len; time_t t = time(NULL); struct tm *tm = localtime(&t); str[0] = '\0'; asctime_r(tm, str); - len = strlen(str); printf("\r"); strip_newlines(str); printf("%s", str);