xref: /inferno-os/module/daytime.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1Daytime: module
2{
3	PATH:	con "/dis/lib/daytime.dis";
4
5	Tm: adt {
6		sec:	int;	# seconds (0 to 59)
7		min:	int;	# minutes (0 to 59)
8		hour:	int;	# hours (0 to 23)
9		mday:	int;	# day of the month (1 to 31)
10		mon:	int;	# month (0 to 11)
11		year:	int;	# year-1900; 2000AD is 100
12		wday:	int;	# day of week (0 to 6, Sunday is 0)
13		yday:	int;	# day of year (0 to 365)
14		zone:	string;	# time zone name
15		tzoff:	int;	# time zone offset (seconds from GMT)
16	};
17
18	# now:
19	# return the time in seconds since the epoch
20	#
21	# time:
22	# return the current local time as string
23	#
24	# text:
25	# convert a time structure from local or gmt
26	# into a text string
27	#
28	# filet:
29	# return a string containing the file time
30	# prints mon day hh:mm if the file is < 6 months old
31	# 	 mon day year  if > 6 months old
32	#
33	# local:
34	# uses /locale/timezone to convert an epoch time in seconds into
35	# a local time structure
36	#
37	# gmt:
38	# return a time structure for GMT
39	#
40	# tm2epoch:
41	# convert a time structure to an epoch time in seconds
42	#
43	# string2tm:
44	# parse a string representing a date into a time structure
45	now:		fn(): int;
46	time:		fn(): string;
47	text:		fn(tm: ref Tm): string;
48	filet:		fn(now, file: int): string;
49	local:		fn(tim: int): ref Tm;
50	gmt:		fn(tim: int): ref Tm;
51	tm2epoch:	fn(tm: ref Tm): int;
52	string2tm:	fn(date: string): ref Tm;
53};
54