aboutsummaryrefslogtreecommitdiff
path: root/src/date.h
blob: bda32a031fe800433bb567d16562a480999c9afd (plain) (blame)
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
#pragma once
// compatibility flags

// GNU-ish systems require this to expose tm_gmtoff and tm_zone
// this is important because of how we detect their existence
#define _GNU_SOURCE 1

#include <janet.h>
#include <time.h>
#include "polyfill.h"

// util.c
JanetBuffer *strftime_buffer(const char *format, const struct tm *tm, JanetBuffer *buffer);

// time.c
extern const JanetRegExt jd_time_cfuns[];
time_t *jd_gettime(Janet *argv, int32_t n);
time_t *jd_maketime(void);
JANET_CFUN(jd_gmtime);
JANET_CFUN(jd_localtime);
JANET_CFUN(jd_time);

// tm.c
extern const JanetRegExt jd_tm_cfuns[];
struct tm *jd_gettm(Janet *argv, int32_t n);
struct tm *jd_opttm(Janet *argv, int32_t argc, int32_t n);
struct tm *jd_maketm(void);
JANET_CFUN(jd_mktime);
JANET_CFUN(jd_mktime_inplace);
JANET_CFUN(jd_timegm);
JANET_CFUN(jd_timegm_inplace);
JANET_CFUN(jd_strftime);