summaryrefslogtreecommitdiff
path: root/lib/date/types.myr
blob: 08490527aa6d97f82e9d402dadf341dc5d3aa926 (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
use std

pkg date = 
	type instant = struct
		actual	: std.time	/* epoch time in microseconds */
		tzoff	: duration	/* timezone offset in microseconds */
		year	: int		/* year, starting at 0 (ie, 1 BCE) */
		mon	: int		/* month, [1..12] */
		day	: int		/* day, [1..31] */
		wday	: int		/* weekday, [0..6] */
		h	: int		/* hour: [0..23] */
		m	: int		/* minute: [0..59] */
		s	: int		/* second: [0..59] */
		us	: int		/* microsecond: [0..999,999] */
		tzname	: byte[:]	/* current time zone name */
		_tzbuf	: byte[32]	/* current time zone name storage */
	;;

	type duration = std.time

	type period = union
		`Year	int
		`Month	int
		`Day	int
		`Hour	int
		`Minute	int
		`Second	int
	;;
	const Datetimefmt
	const Timefmt
	const Datefmt

;;
const Datetimefmt	= "%Y-%m-%d %H:%M:%S %z"
const Timefmt	= "%h:%m:{} %z"
const Datefmt	= "%Y-%m-%d %z"