shithub: mc

ref: 8a92415ad8220c1f651b0ed6338efb072e848d5c
dir: /lib/date/types.myr/

View raw version
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"