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