#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; }