]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_time.c
Some information on building i3status from source
[i3/i3status] / src / print_time.c
index 68714372bd1acc2bf5c05350dd52052c0d81a798..00a619636decd905bf9b9e40108c055df165bbb1 100644 (file)
@@ -2,12 +2,17 @@
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <yajl/yajl_gen.h>
+#include <yajl/yajl_version.h>
 
-void print_time(const char *format) {
-        static char part[512];
+#include "i3status.h"
+
+void print_time(yajl_gen json_gen, char *buffer, const char *format, struct tm *current_tm) {
+        char *outwalk = buffer;
+        if (current_tm == NULL)
+                return;
         /* Get date & time */
-        time_t current_time = time(NULL);
-        struct tm *current_tm = localtime(&current_time);
-        (void)strftime(part, sizeof(part), format, current_tm);
-        printf("%s", part);
+        outwalk += strftime(outwalk, 4095, format, current_tm);
+        *outwalk = '\0';
+        OUTPUT_FULL_TEXT(buffer);
 }