-
-
Save henrik/856b02213fddb7829fdd to your computer and use it in GitHub Desktop.
Elixir Golf: https://github.com/emson/elixirgolf/issues/5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: This is UTC | |
# NOTE: if run after the new year, might have weird behaviour | |
# ?Ϩ is 1000. Figured it out like so: to_string([1000]) | |
# Changed `:os.system_time(:seconds)` to `:erlang.system_time(1)` after seeing @padde's solution | |
# Changed divmod function to inline div and rem at @padde's suggestion | |
# char count: 176 | |
for x<-1451606400-:erlang.system_time(1)..0do | |
m=div x,60 | |
s=rem x,60 | |
h=div m,60 | |
m=rem m,60 | |
:io.fwrite"~3..0B:~2..0B:~2..0B:~2..0B\r",[div(h,24),rem(h,24),m,s] | |
:timer.sleep ?Ϩend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment