SHOW:
|
|
- or go back to the newest paste.
1 | local monitors = {peripheral.find("monitor")} | |
2 | ||
3 | for i=1,#monitors do | |
4 | monitors[i].clear() | |
5 | monitors[i].setTextScale(3.5) | |
6 | end | |
7 | ||
8 | local function centerText(text) | |
9 | for i=1,#monitors do | |
10 | local x,y = monitors[i].getSize() | |
11 | local x2,y2 = monitors[i].getCursorPos() | |
12 | monitors[i].setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2) | |
13 | monitors[i].write(text) | |
14 | sleep(0.1) | |
15 | end | |
16 | end | |
17 | ||
18 | if (fs.exists("/timezone")) then | |
19 | ||
20 | else | |
21 | print("Enter TimeZone:") | |
22 | local filewrite = fs.open("/timezone","w") | |
23 | filewrite.writeLine(read()) | |
24 | filewrite.close() | |
25 | ||
26 | local start = fs.open("/startup","w") | |
27 | start.writeLine('shell.run("time")') | |
28 | start.close() | |
29 | end | |
30 | ||
31 | fileread = fs.open("/timezone","r") | |
32 | local timezone = fileread.readAll() | |
33 | fileread.close() | |
34 | ||
35 | while true do | |
36 | ||
37 | if (redstone.getInput("right")) then | |
38 | - | centerText(http.get("http://www.timeapi.org/"..timezone.."/in+one+hour?format=%20%25l:%25M%20%25p").readAll()) |
38 | + | centerText(http.get("http://www.timeapi.io/"..timezone.."/in+one+hour?format=%20%25l:%25M%20%25p").readAll()) |
39 | else | |
40 | - | centerText(http.get("http://www.timeapi.org/"..timezone.."/now?format=%20%25l:%25M%20%25p").readAll()) |
40 | + | centerText(http.get("http://www.timeapi.io/"..timezone.."/now?format=%20%25l:%25M%20%25p").readAll()) |
41 | end | |
42 | ||
43 | sleep(0.5) | |
44 | end |