summaryrefslogtreecommitdiff
path: root/src/print_time.c
blob: 00a619636decd905bf9b9e40108c055df165bbb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// vim:ts=8:expandtab
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_version.h>

#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 */
        outwalk += strftime(outwalk, 4095, format, current_tm);
        *outwalk = '\0';
        OUTPUT_FULL_TEXT(buffer);
}