#include "kconfig.h" #include "dwmstatus.h" int print_time( bbuf *buf ) { ASSERT( buf != NULL ); int str_size=0; if ( buf->size < 1 ) { buf->size = 1024; buf->str = malloc( buf->size ); } time_t tim; struct tm *timtm; memset(buf->str, 0, buf->size); //settz(tzname); time( &tim ); timtm = localtime( &tim ); if (timtm == NULL) { perror("localtime"); //exit(1); } #ifdef CONFIG_STATUS_UTF8 /* buf->str[0] = 0x20; buf->str[1] = 0xef; buf->str[2] = 0x8d; buf->str[3] = 0xae; str_size = 2; */ //nerd f64f, //ef 99 8f buf->str[0] = 0xef; buf->str[1] = 0x99; buf->str[2] = 0x8f; str_size = 3; printf("asd1 [%s]\n", buf->str); #endif //printf("%s",asctime(timtm)); strftime(&buf->str[str_size], buf->size-1-str_size,"%H:%M ", timtm); //if (!strftime(buf->str, buf->size-1, "%H:%M", timtm)) //{ // fprintf(stderr, "strftime == 0\n"); //exit(1); //} printf("asd1 [%s]\n", buf->str); //wprintf(L"asd2 [%ls]\n", buf->str); return 0; }