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