summaryrefslogtreecommitdiff
path: root/src/print_time.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2009-10-11 22:11:09 +0200
committerMichael Stapelberg <michael@stapelberg.de>2009-10-11 22:14:29 +0200
commitf947d0a446b1b99020722cbc71127fc0c06086b2 (patch)
tree87b75e70a7e2c0d162685221c66beed5f6b6a9e6 /src/print_time.c
parent1d122f32e6d2b0ae1f964dd755d769885c7bf1c2 (diff)
Breaks configfiles! Major refactoring of i3status, see below
We finally switched to libconfuse for a configuration file format which does not require much work for the programmer nor for the user. Plus, it avoids the Not-Invented-Here syndrome of yet another config file format. Furthermore, as a consequence of providing format strings for every "module" (ipv6, wireless, …), we directly print the output and thus we needed to drop support for wmii. This allowed us to get rid of quite some complexity. Documentation about the new configuration file and options will follow. This commit is the beginning of what will be i3status v2.0.
Diffstat (limited to 'src/print_time.c')
-rw-r--r--src/print_time.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/print_time.c b/src/print_time.c
new file mode 100644
index 0000000..6871437
--- /dev/null
+++ b/src/print_time.c
@@ -0,0 +1,13 @@
+// vim:ts=8:expandtab
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void print_time(const char *format) {
+ static char part[512];
+ /* 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);
+}