# 2017 is Almost Here!

Challenge

The challenge is simple:

Taking no inputs and output the following message:

 _     __    __
|   |  | |   |
|_  |__| |   |


A number of times equal to the number of hours before or after midnight UTC on 31st Dec 2016.

Examples

For example if it is 19:01 UTC dec 31st you should output:

 _     __    __
|   |  | |   |
|_  |__| |   |
_     __    __
|   |  | |   |
|_  |__| |   |
_     __    __
|   |  | |   |
|_  |__| |   |
_     __    __
|   |  | |   |
|_  |__| |   |
_     __    __
|   |  | |   |
|_  |__| |   |


if it is 23:24 UTC dec 31st you should output:

 _     __    __
|   |  | |   |
|_  |__| |   |


and if it is 1:42 UTC jan 1st you should output:

 _     __    __
|   |  | |   |
|_  |__| |   |
_     __    __
|   |  | |   |
|_  |__| |   |


Clarification: if it is 10-11pm dec 31st you should output two, 11-12pm dec 31st output one, 00-01am jan 1st output one, 01-02am jan 1st output two etc...

Rules

• No Inputs
• Trailing lines or spaces are ok.
• Your program should work any time or day I run it (albeit with a large output). For example on jan 2nd at 00:15am your code should output 25 times.

(This is my first Code Golf question so if I have left any thing important out please let me know.)

This is Code Golf so Shortest bits win

• Is the number of hours rounded to the nearest integer? If it's within a half-hour of the New-Year-midnight, should there be no output? – Greg Martin Dec 31 '16 at 10:08
• @GregMartin See my edit for clarification. – Quantum spaghettification Dec 31 '16 at 10:10
• What should happen if I run the program on 3 January? – betseg Dec 31 '16 at 10:16
• @betseg ye I just thought about that to. See edit :). It should work the same even though the output will be large. – Quantum spaghettification Dec 31 '16 at 10:18
• Nice first question. About rounding: the number of repetitions is the absolute value of the difference between current time UCT and 0:00:00 of Jan 1st UTC, rounded up. Correct? – edc65 Dec 31 '16 at 10:23

# JavaScript (ES6), 107

As an anonymous method with no parameters

Note 1483228800000 is Date.UTC(2017,0)

_=> _     __    __
|   |  | |   |
|_  |__| |   |
.repeat((Math.abs(new Date-14832288e5)+36e5-1)/36e5)


Test This keeps updating every 1 minute, but you'll need a lot of patience to see the output change.

F=_=>_     __    __
|   |  | |   |
|_  |__| |   |
.repeat((Math.abs(new Date-14832288e5)+36e5-1)/36e5)

update=_=>O.textContent=F()

setInterval(update,60000)

update()
<pre id=O></pre>

# Python 2 - 97 + 17 = 114 bytes

import time
print'_     __    __\n |   |  | |   |\n |_  |__| |   |\n'*int((abs(time.time()-1483228800)+3599)/3600)


Borrowed logic for ceiling from edc65's answer.

Python 3.5 - 116 bytes

import time,math
print('_     __    __\n |   |  | |   |\n |_  |__| |   |\n'*math.ceil(abs(time.time()/3600-412008)))


math.ceil returns an integer in 3.x whereas in 2.x it returns a float.

Thanks elpedro for saving 3 bytes.

• @ElPedro Thanks. Was about to do that, in my previous solutions I was fiddling with datetime.now(pytz.utc).timestamp() which required python 3.5. – Gurupad Mamadapur Dec 31 '16 at 14:09

# Pyth - 71 68 bytes

*"_     __    __
|   |  | |   |
|_  |__| |   |
".Ea412008c.d0 3600


Uses the same logic used in my python 3.5 answer.

Try it here!

• @Quantumspaghettification Isn't this shorter? – Gurupad Mamadapur Jan 15 '17 at 22:24

# C compiled with Clang 3.8.1 327317 145 Bytes

172 bytes saved thanks to @edc65

#include <time.h>
t;main(){time(&t);t=abs(difftime(t,1483228800)/3600);while(t--)puts(" _     __    __\n  |   |  | |   |\n  |_  |__| |   |\n");}


# Ungolfed

#include <time.h>
t;
main()
{
time(&t);

t=difftime(t, 1483228800)/3600;

while(t--)
puts(" _     __    __\n  |   |  | |   |\n  |_  |__| |   |\n");
}


317 bytes

10 bytes saved thanks to @LegionMammal978

#include <time.h>
t,y,w;main() {struct tm n;time(&t);n=*localtime(&t);n.tm_hour=n.tm_min=n.tm_sec=n.tm_mon=0;n.tm_mday=1;w=n.tm_year;if((w&3)==0&&((w % 25)!=0||(w & 15)==0))w=8784;else w=8760;t=(int)difftime(t, mktime(&n))/3600;t=t<w/2?t:w-t;for(;y++<t;)puts(" _     __    __\n  |   |  | |   |\n  |_  |__| |   |\n");


# Ungolfed

#include <time.h>
t,y,w;
main()
{
struct tm n;
time(&t);

n=*localtime(&t);

n.tm_hour=n.tm_min=n.tm_sec=n.tm_mon=0;
n.tm_mday=1;
w=n.tm_year;

if((w&3)==0&&((w % 25)!=0||(w & 15)==0))w=8784;else w=8760;

t=(int)difftime(t, mktime(&n))/3600;
t=t<w/2?t:w-t;

for(;y++<t;)
puts(" _     __    __\n  |   |  | |   |\n  |_  |__| |   |\n");
}


I will add some explanations when I'll be able to.

• Aren't you able to do n.tm_hour=n.tm_min=...=n.tm_mon=0;? – LegionMammal978 Dec 31 '16 at 13:43
• @LegionMammal978 Oh yeah, I forgot. Thanks. – Wade Tyler Dec 31 '16 at 14:39