projects
/
sysstatus.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
a25d41158241ccf9e210d9da782ea9440a6e0a6e
[sysstatus.git]
/
src
/
status
/
datetime.c
1
#include <stdio.h>
2
#include <time.h>
3
4
#include "status/datetime.h"
5
#include "config.h"
6
7
8
void status_datetime()
9
{
10
time_t nows = 0;
11
struct tm *nowtm;
12
13
nows = time(NULL);
14
if (nows == ((time_t) -1)) {
15
printf(" ^fg(red)ERROR: DATETIME");
16
return;
17
}
18
19
nowtm = localtime(&nows);
20
21
printf(" ^fg(#666666)%d.%d.%d ^fg(grey)%d:%.2d"
22
#ifdef SHOW_SECONDS
23
":%.2d"
24
#endif
25
" "
26
,nowtm -> tm_mday,
27
(nowtm -> tm_mon) + 1,
28
(nowtm -> tm_year) + 1900,
29
nowtm -> tm_hour,
30
nowtm -> tm_min
31
32
#ifdef SHOW_SECONDS
33
,nowtm -> tm_sec
34
#endif
35
);
36
}