summaryrefslogtreecommitdiff
path: root/src/time/localtime.c
blob: 3fbe174a346e42dbddc4b36de745e346a50bb935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <time.h>
#include "_safety.h"

/** convert arithmetic time to broken down time **/

struct tm * localtime(const time_t * timer)
{
	static struct tm tm = {0};

	SIGNAL_SAFE(0);
	ASSERT_NONNULL(timer);

	#ifdef _POSIX_SOURCE
	tzset();
	#endif

	tm = *gmtime(timer);
	/* TODO: adjust for timezone */

	return &tm;
}

CHECK_1(struct tm *, NULL, localtime, const time_t *)

/***
converts the locale time at ARGUMENT(timer) to a filled out STRUCTDEF(tm).
***/

/*
RETURN_ALWAYS(a pointer to the converted object)
STDC(1)
*/