-
Notifications
You must be signed in to change notification settings - Fork 7
/
time.m
54 lines (42 loc) · 1 KB
/
time.m
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
44
45
46
47
48
49
50
51
52
53
54
# calendar, date and time, epoch
lib_time = Dl 'time' : out:Mem? out:Mem
lib_strftime = Dl 'strftime' : out:Mem? size:N? format:S? time:Mem? size:N
lib_gmtime = Dl 'gmtime' : time:Mem? Mem
now _ : Mem =
out = Mem 8
Fun.call1 lib_time out
out
gmtime time:Mem : Mem = Fun.call1 lib_gmtime time
# http://en.wikipedia.org/wiki/ISO_8601
datetime_iso time:Mem : S =
out = S.new 16
Fun.call4 lib_strftime out.S.mem 16 '%Y%m%dT%H%M%SZ' time
out
date_iso time:Mem : S =
out = S.new 8
Fun.call4 lib_strftime out.S.mem 8 '%Y%m%d' time
out
datetime _ : S = 0.now.gmtime.datetime_iso
date _ : S = 0.now.gmtime.date_iso
#
month = Tag
Jan = January
Feb = February
Mar = March
Apr = April
May = May
Jun = June
Jul = July
Aug = August
Sep = September
Oct = October
Nov = November
Dec = December
day = Tag
Mon = Monday
Tue = Tuesday
Wed = Wednesday
Thu = Thursday
Fri = Friday
Sat = Saturday
month_days = Row 31 28 31 30 31 30 31 31 30 31 30 31