comparison bin/uptime @ 12140:2826c0c87d92 draft

<b_jonas> fetch /hackenv/bin/uptime https://hack.esolangs.org/get/bin/uptime
author HackEso <hackeso@esolangs.org>
date Sun, 17 Nov 2019 20:11:40 +0000
parents c2f4b787425f
children bbcac610574d
comparison
equal deleted inserted replaced
12139:c2f4b787425f 12140:2826c0c87d92
18 elif "h" == c: 18 elif "h" == c:
19 print(helpmsg, file = sys.stdout) 19 print(helpmsg, file = sys.stdout)
20 sys.exit(0) 20 sys.exit(0)
21 else: 21 else:
22 print("uptime: invalid option -- '" + c + "'\n" + helpmsg, file = sys.stderr) 22 print("uptime: invalid option -- '" + c + "'\n" + helpmsg, file = sys.stderr)
23 sys.exit(0) 23 sys.exit(1)
24 if opt_s: 24 if opt_s:
25 print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(boottime))) 25 print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(boottime)))
26 else: 26 else:
27 now = time.time() 27 now = time.time()
28 uptime_s = now - boottime 28 uptime_s = now - boottime