aboutsummaryrefslogtreecommitdiff
path: root/misc.c
blob: e5bdeefdf72cade128ea2cf235b5c9875c88f0a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <err.h>
#include <time.h>
#include <stdio.h>
#include "misc.h"

char *
date(int timestamp)
{
	char *buf;
	time_t *t;
	
	if(!(buf = malloc(20)))
		err(1, "malloc");
	
	t = localtime(&timestamp);
	strftime(buf, 20, "%Y-%m-%d %H:%M", t);
	
	return buf;
}