summaryrefslogtreecommitdiff
path: root/ext/Time/Piece/Piece.xs
blob: d888588dcbe45c1b490ba85b13f4e93a40d7320c (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
33
34
35
36
37
38
39
40
41
42
43
#ifdef __cplusplus
#extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <time.h>
#ifdef __cplusplus
}
#endif

MODULE = Time::Piece         PACKAGE = Time::Piece

PROTOTYPES: ENABLE

char *
__strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
	char *		fmt
	int		sec
	int		min
	int		hour
	int		mday
	int		mon
	int		year
	int		wday
	int		yday
	int		isdst

    PREINIT:
    char *buf = NULL;

    CODE:
    #XXX: an sv_strftime() that can make use of the TARG would faster
    buf = my_strftime(fmt, sec, min, hour, mday, mon, year, wday, yday, isdst);
    RETVAL = buf;

    OUTPUT:
    RETVAL

    CLEANUP:
    if (buf) {
        Safefree(buf);
    }