aboutsummaryrefslogtreecommitdiffstats
path: root/status/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'status/time.c')
-rw-r--r--status/time.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/status/time.c b/status/time.c
new file mode 100644
index 0000000..f02e2bf
--- /dev/null
+++ b/status/time.c
@@ -0,0 +1,59 @@
+
+#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;
+}
+
+