Configure time zone
This commit is contained in:
parent
28b0204fdd
commit
b29c35b91b
@ -1,3 +1,3 @@
|
|||||||
FROM alpine:edge as builder
|
FROM alpine:edge as builder
|
||||||
|
|
||||||
RUN apk add -u crystal shards libc-dev
|
RUN apk add -u crystal shards tzdata libc-dev
|
||||||
|
@ -36,6 +36,11 @@ router.add "help", "Show all commands" do |p|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_time(ts)
|
||||||
|
t = Time.unix(ts).in(Time::Location.load("Europe/Moscow"))
|
||||||
|
t.to_s("%H:%M:%S")
|
||||||
|
end
|
||||||
|
|
||||||
def render_map(world)
|
def render_map(world)
|
||||||
size = world.map.size
|
size = world.map.size
|
||||||
(0...size).each do |x|
|
(0...size).each do |x|
|
||||||
@ -80,9 +85,8 @@ def render_commands(world)
|
|||||||
if items.size != 0
|
if items.size != 0
|
||||||
printf "Queue:\n"
|
printf "Queue:\n"
|
||||||
end
|
end
|
||||||
time = ->(ts : Int64) { Time.unix(ts).to_local.to_s }
|
|
||||||
items.each do |i|
|
items.each do |i|
|
||||||
printf " %s, %s\n", time.call(i.ts), i.command.desc
|
printf " %s, %s\n", render_time(i.ts), i.command.desc
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,7 +97,7 @@ def render_resources(world)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_world(world)
|
def render_world(world)
|
||||||
printf "Now:\n %s\n\n", Time.unix(world.ts).to_local.to_s
|
printf "Now:\n %s\n\n", render_time(world.ts)
|
||||||
if world.win?
|
if world.win?
|
||||||
printf "YOU WIN!!!\n\n"
|
printf "YOU WIN!!!\n\n"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user