Configure time zone

This commit is contained in:
Anton Vakhrushev 2019-10-08 16:57:36 +03:00
parent 28b0204fdd
commit b29c35b91b
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,3 @@
FROM alpine:edge as builder
RUN apk add -u crystal shards libc-dev
RUN apk add -u crystal shards tzdata libc-dev

View File

@ -36,6 +36,11 @@ router.add "help", "Show all commands" do |p|
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)
size = world.map.size
(0...size).each do |x|
@ -80,9 +85,8 @@ def render_commands(world)
if items.size != 0
printf "Queue:\n"
end
time = ->(ts : Int64) { Time.unix(ts).to_local.to_s }
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
@ -93,7 +97,7 @@ def render_resources(world)
end
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?
printf "YOU WIN!!!\n\n"
end