25
\$\begingroup\$

This question already has an answer here:

I'm currently cooking us some cup noodles, but we're really sleepy at the moment. They'll be finished in 50 seconds from now, can you wake me up then?

Problem:

Write a program or function that waits 50 seconds of busy waiting (so that you too doesn't sleep) and then outputs at least 1 visible character to wake me up.

Busy waiting:

You can't use functions like sleep or delay or pause to wait for the 50 seconds, you have to keep checking the elapsed time.

Rules:

  • Your code must be somewhat consistent in time, between runs and between computers. A small error of +- 1 seconds is acceptable.
  • You can't output any visible characters between 1 and 50 seconds (let me sleep).
  • Whitespace characters (newline, space, tab, ...) are not considered visible characters for this challenge.
  • This is , so shortest code wins.
\$\endgroup\$

marked as duplicate by Beta Decay, Blue code-golf May 20 '17 at 10:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Can the output be non-deterministic (something different every time)? \$\endgroup\$ – Comrade SparklePony May 7 '17 at 14:49
  • \$\begingroup\$ @ComradeSparklePony if it always outputs at least 1 visible character, sure \$\endgroup\$ – Felipe Nardi Batista May 7 '17 at 14:50
  • 26
    \$\begingroup\$ The problem with this approach is the risk that the CPU fan will wake you up early... \$\endgroup\$ – Neil May 7 '17 at 15:35
  • 4
    \$\begingroup\$ Is it ok to reboot the machine after printing the "visible characters"? \$\endgroup\$ – Matteo Italia May 7 '17 at 16:24
  • 1
    \$\begingroup\$ @TheLethalCoder it can be a value returned by a method, but when printed must have at least 1 visible character \$\endgroup\$ – Felipe Nardi Batista May 8 '17 at 14:33

36 Answers 36

12
\$\begingroup\$

MATL, 7 bytes

1`Z`50<

Try it online! The linked code uses 10 instead of 50.

Explanation

1        % Push 1
`        % Do...while
  Z`     %   Elapsed time since program started
  50     %   Push 50
  <      %   Less than?
         % End (implicit). The loop continues if top of the stack is truthy
         % Display (implicit)
\$\endgroup\$
  • \$\begingroup\$ I think this code is pretty self-explanatory. \$\endgroup\$ – Erik the Outgolfer May 7 '17 at 14:56
  • 1
    \$\begingroup\$ @Erik And very similar to Stewie's answer. Anyway I'll add an explanation later \$\endgroup\$ – Luis Mendo May 7 '17 at 15:04
19
\$\begingroup\$

Octave, 22 21 bytes

Saved one byte by changing from while ... end to do ... until.

tic;do
until toc>50;1

tic starts a timer, while toc returns the number of decimal seconds since the last call to tic. We initiate a do - until loop, where we'll loop until toc>50, doing nothing inside the loop. The loop stops after 50 seconds, followed by ans = 1 on the screen.

Try it on TIO (time changed to 5 seconds) or paste it into Octave Online.

\$\endgroup\$
  • \$\begingroup\$ Does this also work in Octave online? \$\endgroup\$ – Michthan May 8 '17 at 10:06
  • 2
    \$\begingroup\$ @Michthan yes. Links added to TIO and Octave Online. I recommend choosing a lower time than 50 seconds when testing it :) \$\endgroup\$ – Stewie Griffin May 8 '17 at 10:24
11
\$\begingroup\$

Lua, 35 bytes

while os.clock()<50 do end;print'!'

odd thing is that it has exactly the same length as:

repeat until os.clock()>50;print'!'

Try it online!

\$\endgroup\$
  • \$\begingroup\$ I don't know Lua, but can't you print a number and save 2 bytes? \$\endgroup\$ – totallyhuman May 8 '17 at 20:41
  • \$\begingroup\$ For @totallyhuman and those curious: print 2 results in a syntax error, whereas print'!' will print !. See section 3.4.10 of the lua manual. Arguments have the following syntax: ‘(’ [explist] ‘)’ | tableconstructor | LiteralString (I shortened the BNF because line breaks don't work in comments) \$\endgroup\$ – Finn O'leary May 8 '17 at 20:58
8
\$\begingroup\$

TI-Basic, 14 12 bytes

startTmr
While 50>checkTmr(Ans
End

(Ab)uses the fact that TI programs output Done if nothing is evaluated on the last line.

\$\endgroup\$
  • \$\begingroup\$ I'm new to golfing, so can you explain to me how this is 12 bytes. I count 35. Thx. \$\endgroup\$ – gogators May 11 '17 at 18:03
  • \$\begingroup\$ @gogators Check out this answer I wrote on this subject, it will explain everything for you: codegolf.meta.stackexchange.com/a/4764/10740 \$\endgroup\$ – Timtech May 11 '17 at 18:12
7
\$\begingroup\$

Perl 5.10, 21 bytes

{$^T+50<time?do:redo}

Outputs "Null filename used at -e line 1." after [50,51) seconds.

Or 22 bytes for Perl 5.22:

{$^T+50<time?die:redo}
\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to PPCG! It's easier for people to understand your byte count if you just present it as {$^T+50<time?do:redo} (most people will know how to invoke it or those who don't know probably also don't need to know). \$\endgroup\$ – Martin Ender May 7 '17 at 20:50
  • \$\begingroup\$ Does this require any specific Perl version? The 5.22.2 I have displays “syntax error at -e line 1, near "do:"” immediately. \$\endgroup\$ – manatwork May 8 '17 at 15:50
  • \$\begingroup\$ @manatwork I verified that you are correct and that it works with perl 5.10. \$\endgroup\$ – gogators May 8 '17 at 20:29
  • \$\begingroup\$ as stderr is ignored by default, could you change it to output to stdout? \$\endgroup\$ – Felipe Nardi Batista May 10 '17 at 13:19
  • 1
    \$\begingroup\$ Explicitly, it say "STDERR can be ignored completely, as long as STDOUT has the required output". Which means the same as "STDERR may be considered if STDOUT does not have the required output". In this case STDOUT does not have the required output, so STDERR need not be ignored. \$\endgroup\$ – gogators May 19 '17 at 21:19
6
\$\begingroup\$

Python 2, 57 54 bytes

-3 bytes thanks to Felipe Nardi Batista.

from time import*
b=time()+50
while time()<b:0
print 1

Try it online!

Another solution, 48 bytes

This answer will only work if printing to STDERR is allowed. This will end in a NameError, printing much more than one character.

from time import*
b=time()+50
while time()<b:0
a
\$\endgroup\$
5
\$\begingroup\$

APL (Dyalog), 21 bytes

-1 thanks to marinus.

{3⊃⍵≥⎕AI:∇⍵⋄1}5e4+⎕AI

⎕AIAccount Information (UserID, ComputeTime, ConnectTime, KeyingTime)

5E4+ add 50000 (milliseconds)

{ apply the following anonymous function where the argument is represented by

 [if the]

  3⊃ third item (truth value, i.e that of ConnectTime) of
  ⍵≥⎕AI is greater than or equal to Account Information

: then

  ∇⍵ recurse this function on the unmodified argument

 else

  1 return one

} [end of anonymous function]

Try it online! Debug says Real time: 50.039 s, or disable output cache for real-time effect.

\$\endgroup\$
  • \$\begingroup\$ With a d-fn it's one shorter: {3⌷⍵≥⎕AI:∇⍵⋄1}5e4+⎕AI \$\endgroup\$ – marinus May 8 '17 at 21:02
  • \$\begingroup\$ @marinus Thanks. \$\endgroup\$ – Adám May 9 '17 at 5:56
5
\$\begingroup\$

C, 45 44 43 bytes

i;f(){for(time(&i);time(0)-i<50;);puts(f);}

See it work here.

\$\endgroup\$
  • \$\begingroup\$ is it guaranteed that the puts(f) will always have at least 1 visible character? \$\endgroup\$ – Felipe Nardi Batista May 9 '17 at 10:49
  • \$\begingroup\$ @FelipeNardiBatista It will on the implementation I choose (See the link). Otherwise It is necessary to check that the function f isn't aligned to or more than 0xFF bytes. This can be manipulated using compiler flags. \$\endgroup\$ – 2501 May 9 '17 at 10:53
5
\$\begingroup\$

Bash, 26 bytes

f()(((SECONDS<50))&&f);f;.

Partially ungolfed:

f () (
  ((SECONDS < 50)) && f
)
f
.

SECONDS is a magic variable that counts the number of seconds since the shell started. I define a function that recurses until the value is below the threshold. Once the wait is over, run the builtin . which prints an error message because it's missing an argument.

Beware that since the function's body is in parentheses, bash forks a new process for each recursive invocation, which may consume a lot of entries in your process table. A loop would keep resource usage down, but it's longer.

for((;SECONDS<50;));do :;done;.

If you want to have output on standard output rather than to the screen and you're running a sufficiently Unix-like system with at least one user logged in, you can replace the final . by w. If you want to stick to pure bash then I can't think of a way to produce output in less than 28 bytes.

f()(((SECONDS<50))&&f);f;pwd
\$\endgroup\$
  • \$\begingroup\$ as stderr is ignored by default, could you change it to output to stdout? \$\endgroup\$ – Felipe Nardi Batista May 10 '17 at 10:52
  • 1
    \$\begingroup\$ @FelipeNardiBatista At the time I posted, the requirement was to output to the screen, not to standard output. \$\endgroup\$ – Gilles 'SO- stop being evil' May 10 '17 at 20:08
  • \$\begingroup\$ yes, but as the default is ignoring stderr, your answer would not output anything \$\endgroup\$ – Felipe Nardi Batista May 10 '17 at 20:43
3
\$\begingroup\$

Pyth, 9 bytes

W>50.d1;G

Try it here.

\$\endgroup\$
3
\$\begingroup\$

PHP, 42 36 bytes

for($t=time();time()-$t<50;);echo 1;
  • -6 bytes, thanks to @Titus

How to run

> php -r <code>
\$\endgroup\$
  • \$\begingroup\$ Use -r to avoid the PHP tag. \$\endgroup\$ – Titus May 8 '17 at 9:59
  • \$\begingroup\$ @Titus note taken, thx. \$\endgroup\$ – Khaled.K May 8 '17 at 10:22
3
\$\begingroup\$

Javascript, 43 39 37 35 34 33 bytes

for(t=+new Date;new Date<t+5e4;)1

Outputs 1 after 50 seconds.

Open console and run snippet. The snippet only runs for 5 seconds, so your page won't stall for too long :)

for(t=+new Date;new Date<t+5e3;)1

Saved 10(!) bytes thanks to @CraigAyre:

  • 43 : t=+new Date();while(+new Date()<t+50000)0;x
  • 39 : t=+new Date;while(+new Date<t+50000)0;x
  • 37 : t=+new Date;while(+new Date<t+5e4)0;x
  • 35 : t=+new Date;while(new Date<t+5e4);x
  • 34 : t=+new Date;while(new Date<t+5e4)1
  • 33 : for(t=+new Date;new Date<t+5e4;)1
\$\endgroup\$
  • 1
    \$\begingroup\$ Let us continue this discussion in chat. \$\endgroup\$ – Craig Ayre May 7 '17 at 18:14
  • \$\begingroup\$ in the console it does outputs 1, but not in the snippet, it just freezes my browser for 5 secs. isn't that a JS REPL answer? \$\endgroup\$ – Felipe Nardi Batista May 8 '17 at 14:45
  • \$\begingroup\$ @FelipeNardiBatista I don't know what a JS REPL answer is, but you're right. The previous version of my snippet did output when run. Is it a requirement that it should function when ran as a snippet? \$\endgroup\$ – Thomas W May 8 '17 at 15:29
3
\$\begingroup\$

05AB1E, 16 14 bytes

žc50+60%[DžcQ#

Try it online!

I'm new to 05AB1E, so any golfing tips would be appreciated.

Explanation:

žc50+60%[DžcQ#
žc               Push current amount of seconds.
  50+            Add 50.
     60%         Modulo 60.
        [        Infinite loop.
         D       Duplicate top of stack
          žc     Push current seconds.
            Q#   If current seconds, and start time+50 are the same, break.
                 Implicit print.

The basic idea of this program is to get what the time will be in 50 secs and loop until the current time is equal. So to get the time in 50 seconds, it gets the current time and adds 50. Then, since 05AB1E's clock returns the time since the last minute change, it needs to modulo 60, to get back in the correct range. Then the program loops until the second amount is the same as the desired.

\$\endgroup\$
3
\$\begingroup\$

Ruby, 36 33 35 bytes

t=Time.now;1until Time.now-t>50;p 1

Ruby handily supports subtraction of Time objects, returning the difference in seconds. Prints the character 1 (being Ruby's internal representation of the entity 1) when done.

Edit: saved 2 bytes by changing to an error message, 1 byte thanks to G B Edit: re-added 2 bytes (stderr doesn't count)

\$\endgroup\$
  • \$\begingroup\$ I can shave two characters (the ` 1` from the end) if throwing an error counts as displaying output :) \$\endgroup\$ – Chowlett May 8 '17 at 15:35
  • \$\begingroup\$ You could use 1while instead of {}while to save another character. \$\endgroup\$ – G B May 9 '17 at 12:20
  • \$\begingroup\$ as stderr is ignored by default, could you change it to output to stdout? \$\endgroup\$ – Felipe Nardi Batista May 10 '17 at 10:53
  • \$\begingroup\$ Shame. That's two bytes longer. \$\endgroup\$ – Chowlett May 10 '17 at 17:31
2
\$\begingroup\$

Processing, 47 bytes

void draw(){if(millis()>5e4){print(X);exit();}}

After 50 seconds, the program prints 0 and exits.

\$\endgroup\$
  • \$\begingroup\$ What language is that? \$\endgroup\$ – 2501 May 7 '17 at 17:08
  • \$\begingroup\$ @2501 It's Processing: processing.org \$\endgroup\$ – Kritixi Lithos May 7 '17 at 17:08
  • \$\begingroup\$ What is X, where is it being defined? \$\endgroup\$ – Pavel May 7 '17 at 18:43
  • 1
    \$\begingroup\$ @Phoenix It is one of Processing's constants, PI is an example. They do not have to be initialised. You can see the implementation of X here: github.com/processing/processing/blob/master/core/src/… \$\endgroup\$ – Kritixi Lithos May 7 '17 at 19:03
2
\$\begingroup\$

PowerShell, 38

for($d=(date)+[int]5e8;(date)-lt$d){}1

Very trivial; will just wait until the time is 50 seconds later and then prints 1.

\$\endgroup\$
2
\$\begingroup\$

Java, 116 114 109 105 bytes

  • -2 bytes, thanks to @jaxad0127
  • -4 bytes, thanks to @KevinCruijssen

Try Online

double t(){return System.nanoTime();}
void w(){for(double s=t();t()-s<5e+10;);System.out.print("\0007!");}

Note on unix, this should ring a beep.

\$\endgroup\$
  • \$\begingroup\$ You can save some bytes by using 5e4 instead of 50000. \$\endgroup\$ – jaxad0127 May 7 '17 at 19:26
  • \$\begingroup\$ @jaxad0127 done, thanx for the tip \$\endgroup\$ – Khaled.K May 8 '17 at 6:58
  • \$\begingroup\$ You can save a byte by changing the while to a for and put s inside it: for(long s=t();t()-s<5e4;); Also, I count 109 bytes in your current answer instead of 108 (after removing the newline). With the while to for loop change it becomes 108 however. Also, why use System.currentTimeMillis() when System.nanoTime() is shorter? \$\endgroup\$ – Kevin Cruijssen May 8 '17 at 9:40
  • \$\begingroup\$ @KevinCruijssen yes, change considered now. \$\endgroup\$ – Khaled.K May 8 '17 at 10:18
  • \$\begingroup\$ you don't need the \a (\0007), you'll just lose some bytes \$\endgroup\$ – Felipe Nardi Batista May 8 '17 at 10:42
2
\$\begingroup\$

x86 16 bit machine code on MS-DOS - 21 bytes

00000000  53 1f a1 6c 04 05 8e 03  3b 06 6c 04 77 fa b2 6e  |S..l....;.l.w..n|
00000010  b4 02 cd 21 c3                                    |...!.|
00000015

Commented assembly:

    org 100h

section .text

start:
    push bx             ; notice: bx starts as 0
    pop ds              ; set the data segment to 0; this allows us to
                        ; read the tick count without segment selectors
    mov ax,word [046ch] ; read the low 16 bit of the tick count
    add ax,910          ; 910 ticks = 49.98 seconds
                        ; here we used ax because the encoding for both
                        ; the mov and the add is one byte shorter
lop:
    cmp ax,word [046ch] ; compare the stop time with the current time
    ja lop              ; loop if still above
    mov dl,'n'          ; n is for noodles
    mov ah,2
    int 21h             ; print
    ret                 ; quit

This could be shaved down to 16 bytes by replacing the final three instructions with int 18h, which on ancient machines would invoke the ROM built-in BASIC interpreter and almost everywhere else prints something like "No ROM BASIC" and reboot after a key press, but after discussing this with OP it was decided that this wouldn't be allowed.

Interrupt + self-modifying code approach - 23 bytes

This is another approach; it turns out to be bigger, but I post it anyway because it is way more fun.

00000000  b8 1c 25 ba 12 01 cd 21  b9 8e 03 e2 fb b4 02 cd  |..%....!........|
00000010  21 c3 ff 0e 09 01 cf                              |!......|
00000017

 

    org 100h

section .text

%define counter lop+1   ; see below
start:
    ; setup interrupt handler
    mov ax,251ch                ; function 25h (replace interrupt vector)
                                ; interrupt 1ch (user timer)
    mov dx,interrupt_handler    ; timer ISR
    int 21h
lop:
    mov cx,910  ; the 910 immediate value is actually pointed by counter,
                ; which is decremented in interrupt_handler
    loop lop    ; decrement and loop as long as cx is nonzero (the decrement is
                ; not relevant, we are always resetting cx at each iteration)
    mov ah,2    ; function 2 (print character); dl is already a printable character
    int 21h
    ret         ; quit

interrupt_handler:
    dec word[counter]   ; at every tick decrement the counter
    iret
\$\endgroup\$
2
\$\begingroup\$

PHP, 43 bytes

I think when you´re sleepy, your ears are more alert than your eyes, so:

for($t=time();;)echo chr(time()-$t<50?9:7);

prints horizontal tabs in the first 50 seconds, BEL codes after that. Run with -r.

\$\endgroup\$
  • \$\begingroup\$ I haven't thought about printing (non visible) characters before the time limit, nice. \$\endgroup\$ – Felipe Nardi Batista May 8 '17 at 10:44
  • \$\begingroup\$ Is the Elvis operator a thing in PHP? ?:, could save a byte by printing the time()-$t implicitly instead of tabs? \$\endgroup\$ – Magic Octopus Urn May 8 '17 at 15:01
  • \$\begingroup\$ @carusocomputing Elvis would print the difference or the else branch; i.e. some ASCII between 0 and 49; but there shouldn´t be any printable in the first 50 seconds -> not applicable here. \$\endgroup\$ – Titus May 8 '17 at 16:52
  • \$\begingroup\$ Then why is printing tabs acceptable? \$\endgroup\$ – Magic Octopus Urn May 8 '17 at 18:03
  • \$\begingroup\$ @carusocomputing Whitespace characters (newline, space, tab, ...) are not considered visible characters for this challenge. \$\endgroup\$ – Titus May 9 '17 at 6:18
2
\$\begingroup\$

C# - 100 bytes

using System;
void q(){var t=DateTime.Now.AddSeconds(50);
while(DateTime.Now<t);
Console.Write(t);
}
\$\endgroup\$
  • \$\begingroup\$ Welcome to PPCG! It looks like there is some white space left which can be removed, e.g. var t=DateTime .... \$\endgroup\$ – Laikoni May 7 '17 at 18:49
  • \$\begingroup\$ Not sure where you're getting 79 bytes from, because your code in it's current state is 92 bytes. Even golfed to remove all whitespace it's still 83 bytes \$\endgroup\$ – Skidsdev May 8 '17 at 8:40
  • \$\begingroup\$ This is 96 bytes if you remove the new lines. \$\endgroup\$ – TheLethalCoder May 8 '17 at 15:30
2
\$\begingroup\$

R, 41 bytes

s=Sys.time;x=s();while(s()-x<50){};cat(1)
\$\endgroup\$
  • 1
    \$\begingroup\$ cat(1) saves 2 bytes \$\endgroup\$ – Felipe Nardi Batista May 8 '17 at 14:05
  • \$\begingroup\$ @FelipeNardiBatista Good idea, thanks. \$\endgroup\$ – Sven Hohenstein May 8 '17 at 15:54
2
\$\begingroup\$

Bash, 68 43 bytes

for((e=`date +%s`+50;`date +%s`<e;)){ :;};w

Lists logged in users after 50 seconds.

Edit: Thanks a lot, manatwork! -25 bytes.

Try it online!

\$\endgroup\$
  • \$\begingroup\$ As I count, would be shorter without variable $t. And avoid expr, Bash can do integer arithmetic itself. And better list the logged in users with w – not just shorter but produces output on TIO too. for((e=`date +%s`+50;`date +%s`<e;)){ :;};w \$\endgroup\$ – manatwork May 8 '17 at 16:05
  • \$\begingroup\$ I had no idea that there is a way to do arithmetic without expr command. From what I read so far, it only works if it's done inside ((...)). Thanks for your help! \$\endgroup\$ – Maxim Mikhaylov May 8 '17 at 17:33
2
\$\begingroup\$

C#, 73 bytes

var n=DateTime.Now.AddSeconds(50);while(DateTime.Now<n);Console.Write(n);

\$\endgroup\$
  • \$\begingroup\$ Hi, you can shave of 8 bytes of this if you change Console.Write(n) to n.Dump(). .Dump() is a LinQPad specific method not a C# one if I'm not mistaken, so I don't know if that is allowed by the rules. (If it is, it saves 8 bytes) \$\endgroup\$ – Bojan B May 9 '17 at 6:34
2
\$\begingroup\$

Aceto, 16 bytes

6+_p
*-iX
59
Tt<

Sets a Timer, reads the timer difference and pushes it on the stack. Pushes 9 and 5, multipl*es them, pushes 6, +dds them. We now have a 51 on the stack (on top of the initially small-ish timer number). We substr-ct them from each other, getting initially something a little bit bigger than 51. We cast it to an integer, and mirror (_) if the integer is truthy (i.e. not 0). In that case, we go to the left (<) and check our timer again, going into a loop. Otherwise, we print 0 from the empty stack, and eXit.

After 50 seconds, the timer will be 50+ε for some small ε, meaning our subtraction yields 50+ε-51 = -ε, since ε is smaller than 1 the corresponding integer will be 0.

\$\endgroup\$
2
\$\begingroup\$

C, 41 43 39 Bytes

a;b(c){time(c?0:&a)-a>50?puts(b):b(1);}

Try it online

\$\endgroup\$
  • \$\begingroup\$ as a function, i can call it as f("") and it won't print anything. you could use 2501's trick to even cut out 1 byte \$\endgroup\$ – Felipe Nardi Batista May 9 '17 at 11:11
  • \$\begingroup\$ Great!. It is still better than mine. \$\endgroup\$ – 2501 May 9 '17 at 15:33
  • \$\begingroup\$ Damn.. I'm out of ideas \$\endgroup\$ – Johan du Toit May 9 '17 at 16:48
  • \$\begingroup\$ @2501, <s>I'm out of ideas</s> ;-) \$\endgroup\$ – Johan du Toit May 10 '17 at 7:04
  • \$\begingroup\$ That is invalid in my opinion, because the function requires an argument. This is similar to having information stored in globals, but isn't counted in the byte score count. (Or resetting globals in between function calls, which is what the argument is doing basically.) \$\endgroup\$ – 2501 May 10 '17 at 7:21
1
\$\begingroup\$

REXX, 33 bytes

do while time(e)<50
  nop
  end
say a
\$\endgroup\$
1
\$\begingroup\$

C#, 91 77 bytes

n=()=>System.DateTime.Now;_=>{var t=n();while((n()-t).Seconds<50);return t;};
\$\endgroup\$
1
\$\begingroup\$

T-SQL, 62 bytes

DECLARE @ DATETIME=GETDATE()WHILE DATEDIFF(S,@,GETDATE())<50_:

After the execution in SSMS, this will print the message "Command(s) completed successfully." plus a bell sound [bonus :)].

\$\endgroup\$
1
\$\begingroup\$

AWK, 48 bytes

BEGIN{for($0=systime();systime()-$0<50;)1;print}

Try it online!

This assumes that input is not allowed.

\$\endgroup\$
1
\$\begingroup\$

Swift - 41 bytes

Just outgolfing @Samira's answer, improving it drastically

var d=Date()+50;while Date()<d{};print(d)

Prints the date it started running to wake one up, e.g: if it's ran at 12:38 UTC, it outputs 2017-05-12 12:38:51 +0000 after 50 seconds.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.