datetime.c - slstatus - status monitor
 (HTM) git clone git://git.suckless.org/slstatus
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       datetime.c (358B)
       ---
            1 /* See LICENSE file for copyright and license details. */
            2 #include <stdio.h>
            3 #include <time.h>
            4 
            5 #include "../slstatus.h"
            6 #include "../util.h"
            7 
            8 const char *
            9 datetime(const char *fmt)
           10 {
           11         time_t t;
           12 
           13         t = time(NULL);
           14         if (!strftime(buf, sizeof(buf), fmt, localtime(&t))) {
           15                 warn("strftime: Result string exceeds buffer size");
           16                 return NULL;
           17         }
           18 
           19         return buf;
           20 }