about summary refs log tree commit diff
path: root/mdate.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-08-08 14:01:05 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-08-08 14:01:05 +0200
commit2a72a341c0444ecf24c9bbb85d7b06636fef2875 (patch)
tree605102d94af8b5bf408a48b621cfb1e252fc76d6 /mdate.c
parent55c823f89af1896bcff24281bcd8535640c9de0b (diff)
downloadmblaze-2a72a341c0444ecf24c9bbb85d7b06636fef2875.tar.gz
mblaze-2a72a341c0444ecf24c9bbb85d7b06636fef2875.tar.xz
mblaze-2a72a341c0444ecf24c9bbb85d7b06636fef2875.zip
add mdate, a portable version of GNU date --rfc-2822
Diffstat (limited to 'mdate.c')
-rw-r--r--mdate.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mdate.c b/mdate.c
new file mode 100644
index 0000000..fa2253d
--- /dev/null
+++ b/mdate.c
@@ -0,0 +1,15 @@
+#include <time.h>
+#include <unistd.h>
+
+int
+main() {
+	char buf[64];
+	time_t now = time(0);
+
+	ssize_t l = strftime(buf, sizeof buf,
+	    "%a, %d %b %Y %T %z\n", localtime(&now));
+	if (write(1, buf, l) == l)
+		return 0;
+
+	return 1;
+}