logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: e3ad3e689537fe4ca38ae4fc78c71e745b74a37f
parent e2313c5ba988ea29b40fa40f37a6241c8cb8bc28
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 27 Jan 2021 21:22:22 +0100

bin/mdate: New util

Diffstat:

Mbin/Makefile.config2+-
Abin/mdate.c17+++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/bin/Makefile.config b/bin/Makefile.config @@ -1 +1 @@ -EXE = args date echo lolcat pwd range sizeof xcd dmenu_path +EXE = args colorpicker date echo lolcat mdate pwd range sizeof xcd xrd diff --git a/bin/mdate.c b/bin/mdate.c @@ -0,0 +1,17 @@ +#define _POSIX_C_SOURCE 200809L +#include <time.h> /* time */ +#include <stdio.h> /* printf */ + +// 3600*24.5 +#define cycle 88200 + +int +main(void) { + time_t now = time(NULL); + time_t date_now = now / cycle; + time_t time_now = now % cycle; + + printf("%lX,%05lX\n", date_now, time_now); + + return 0; +}