Legen… wait for it…

JavaScript (ES6), 74 bytes

You may want to change your system clock before testing, congratulations if you landed here at 59 minutes past.

setTimeout(a=alert,36e5-new Date%36e5,"dary!");a`Legen... wait for it...
`


Pyth, 42 41

J.d6." wâ«­hÖ`Ùá©h´^"WqJ.d6;"dary!

Below is a hexdump of the code:

00000000  4a 2e 64 36 2e 22 20 77  0c 10 89 e2 ab 1b ad 68  |J.d6." w.......h|
00000010  0f 8c d6 60 d9 e1 a9 68  82 b4 5e 22 57 71 4a 2e  |...`...h..^"WqJ.|
00000020  64 36 3b 22 64 61 72 79  21                       |d6;"dary!|

Saved 1 byte thanks to @isaacg

Uses the .d function to get local time related values. .d6 returns the current hour. This prints the first string, then waits until the hour is different from the hour ad the start of the program, and then prints the second string.

You could try it online with .d7 or .d8 for minutes/seconds but the online compiler only prints anything when the program terminates.

Congrats, Dennis! :)


CJam, 49 48 bytes

et3="Legen... wait for it...
"o{_et3==}g;"dary!"

Uses local time. For testing purposes, you can replace the two instances of 3 with 4 or 5 to make it print at the start of the next minute/second.

Test it here. But note that the online interpreter doesn't show any output until the program terminates. Alternatively, you can run it on Try it online, where the output is shown almost immediately instead of being buffered (but when you test it with seconds instead of hours, the delay will be noticeable). In any case, if you run it locally with the Java interpreter, it works like a charm.

Explanation

This makes use of CJam's et which gives you an array of

[year month day hour minute second ms weekday utc_offset]

Here is a breakdown of the code:

et3=       e# Get the current hour.
"Legen..." e# Push the first string including the linefeed.
o          e# Print it.
{          e# While the top of stack is truthy (which is popped)...
  _        e#   Copy the original hour.
  et3=     e#   Get the current hour.
  =        e#   Check for equality.
}g
;          e# Discard the original hour.
"dary!"    e# Push the second string which is printed automatically.

Bonus

This also works for the same byte count:

et4<"Legen... wait for it...
"o{et1$#!}g;"dary!"

Instead of selecting the hour, we're selecting the prefix with the date and the hour, and keep the loop going while the datetime array still has that prefix.

Tags:

Date

Code Golf