blob: f06c61da1d7cef7c1919012f1c7296aeeb71bc6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include "kconfig.h"
#include "dwmstatus.h"
int print_date( bbuf *buf )
{
ASSERT( buf != NULL );
int str_size=0;
if ( buf->size < 1 )
{
buf->size = 1024;
buf->str = malloc( buf->size );
ASSERT( buf->str != NULL );
}
time_t tim;
struct tm *timtm;
memset(buf->str, 0, buf->size);
time( &tim );
timtm = localtime( &tim );
if (timtm == NULL)
{
perror("localtime");
}
#ifdef CONFIG_STATUS_UTF8
buf->str[0] = 0xef;
buf->str[1] = 0x81;
buf->str[2] = 0xb3;
str_size = 3;
#endif
strftime(&buf->str[str_size], buf->size-1-str_size," %d%b%Y", timtm);
return 0;
}
|