diff options
Diffstat (limited to 'statuses/datetime.c')
-rw-r--r-- | statuses/datetime.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/statuses/datetime.c b/statuses/datetime.c index 7c0e479..42b37aa 100644 --- a/statuses/datetime.c +++ b/statuses/datetime.c @@ -7,30 +7,31 @@ void status_datetime() { time_t nows = 0; struct tm *nowtm; - + nows = time(NULL); - if (nows != ((time_t) -1)) + if (nows == ((time_t) -1)) { - nowtm = localtime(&nows); - - printf(" ^fg(#666666)%d.%d.%d ^fg(grey)%d:%.2d" - - #ifdef SHOW_SECONDS - ":%.2d" - #endif - " " - ,nowtm -> tm_mday, - (nowtm -> tm_mon) + 1, - (nowtm -> tm_year) + 1900, - nowtm -> tm_hour, - nowtm -> tm_min - - #ifdef SHOW_SECONDS - ,nowtm -> tm_sec - #endif - - ); - } - else printf(" ^fg(red)ERROR: DATETIME"); + return; + } + + nowtm = localtime(&nows); + + printf(" ^fg(#666666)%d.%d.%d ^fg(grey)%d:%.2d" + + #ifdef SHOW_SECONDS + ":%.2d" + #endif + " " + ,nowtm -> tm_mday, + (nowtm -> tm_mon) + 1, + (nowtm -> tm_year) + 1900, + nowtm -> tm_hour, + nowtm -> tm_min + + #ifdef SHOW_SECONDS + ,nowtm -> tm_sec + #endif + + ); } |