# Sleep for 1000 years

Some sleep commands implement a delay of an integer number of seconds. However, 232 seconds is only about 100 years. Bug! What if you need a larger delay?

Make a program or a function which waits for 1000 years, with an error of less than ±10%. Because it's too time-consuming to test, please explain how/why your solution works! (unless it's somehow obvious)

You don't need to worry about wasting CPU power - it can be a busy-loop. Assume that nothing special happens while your program waits - no hardware errors or power failures, and the computer's clock magically continues running (even when it's on battery power).

What the solution should do after the sleep is finished:

• If it's a program: terminate (with or without error) or do something observable by user (e.g. display a message or play a sound)

# C (gcc), 40 36 32 29 26 24 bytes

i;f(){--i&&f(sleep(7));}


Try it online!

-3 thanks to @gastropner.

-1 recursive approach thanks to @AZTECCO.

4294967295*7/86400/365.25 ~ 952.69

• Witchcraft! Dark Arts!!! Why is it possible to call a function as it is being declared, and more precisely, how can you give a parameter to a parameterless function??? Dec 12, 2019 at 9:46
• @M.Herzkamp (1) because why wouldn't you be able to? (2) in C, a function defined with an empty parameter list (as opposed to a void parameter list) is treated as a varargs function. Dec 12, 2019 at 10:08
• would be more interested why you think this runs 2^32 times - and not 2^31 times - as an i variable would be predefined as going from -2^31 to (2^31)-1 (signed) and I dont see an unsigned definition Dec 12, 2019 at 12:42
• Is i somehow guaranteed to be initialized to 0? I still operate under the assumption that it should be treated as garbage if not initialized; then again, I frequently have to work with ancient legacy code that still uses old compilers. Dec 12, 2019 at 17:07
• Dec 12, 2019 at 19:10

# Python 3 (Excluding CPython on Windows), 28 bytes

import time
time.sleep(3e10)


Try it online! (Remember to put something in your will so future generations can check that it ended on time.)

time.sleep(seconds) takes either an int or a float.

1000*365.2422*24*60*60/3e10 == 1.051897536 which is an error of less than 10%.

• This does not work in CPython on Windows. time.sleep of CPython only supports sleeping up to 2^32-1 ms = a little bit less than 50 days. (Limit imposed by WinAPI Sleep) Dec 12, 2019 at 9:02
• @JiminP Just goes to show you: If you want to run something for a millennium - don't do it on Windows! T_T Dec 12, 2019 at 10:48

# bash, 26 24 bytes

I think part of the challenge here is to not have a signed 32 bit overflow, so:

ping -i86400 -c365243 t.co


The idea here is to make 1000 years of pings (365243), once per day (86400).

"t.co" is simply a four character internet hostname (in this case, a link shortener). If your local host table has a one character hostname, you can subtract 3 bytes.

Edit: corvus-192 points out that country code ai resolves as a host, so you can write:

ping -i86400 -c365243 ai


As this will should work for anyone, I will accept this. Saved 2 bytes.

• You have more faith in the longevity of IPv4 than I do. Dec 13, 2019 at 5:34
• @Caleb: This only has to start today, on a system that will stay up for 1000 years, not continue to do IPv4 DNS lookups. But yes, ping on my GNU/Linux system supports IPv6 addresses (without having to invoke it as ping6), and localhost is ::1 saving 1 byte. ping :: also works, for the IPv6 unspecified address, saving 2 bytes but getting error messages (ping: sendmsg: Network is unreachable). Dec 13, 2019 at 8:51
• Do you need to ping a working domain? Wouldn't this still work according to spec if all the pings failed by calling a fake domain like t? Dec 13, 2019 at 15:18
• With my version of ping, ping 1 attempts to ping 0.0.0.1, which saves 3 characters if you can get that IP to ping. Dec 13, 2019 at 16:01
• For me, ai resolves to 209.59.119.34, which is 2 bytes shorter. Oct 26, 2020 at 14:33

# MATL, 6 5 bytes

35WY.


This waits for 34359738368 seconds, which is a little more than 1089 years and a half.

Don't try it online!

### Explanation

35     % Push 35
W      % 2 raised to that. Gives 34359738368
Y.     % Pause for that many seconds

• I doubt anyone will find any way that beats this. Then again, I'm surprised to see it this short, so I could be surprised again. The only way I can think of is if another language can do basically the same thing but has a 1-character sleep function (as opposed to 2 ["Y."]). Dec 12, 2019 at 17:26

# Ruby, 10 bytes

sleep 3e10


Try it online!

There are approximately $$\3*10^{10}\$$ seconds in a thousand years.

• sleep 32e9 is more accurate and has the same size in bytes
– G B
Dec 13, 2019 at 9:13
• 31557600000 seconds Dec 13, 2019 at 12:47
• "Try it online!". LOL Dec 13, 2019 at 18:21

# PowerShell, 35322421 19 bytes

1..3e4|%{sleep 1mb}


Try it online!

Strangely, the maximum seconds value for Start-Sleep is 2147483. No, I don't know why it's such an odd value. That works out to a little over 2 megabytes (2097152). 1mb * 30000 / 86400 / 365.25 is 996.821051030497, so a little under 1000 years. I could get more exact using a different value than 3e4, but this is within the allowed margin and I'm lazy.

Saved 3 bytes thanks to ceilingcat.
Saved 8 bytes thanks to Jeff Zeitlin.
Saved 3 bytes thanks to Neil.
Saved 2 bytes thanks to Mark Henderson and Nahuel Fouilleul.

• Well, 2147483 is 1/1000th of a max 32-bit integer, so perhaps Powershell internally does some unit conversions with milliseconds or something. See here (MaxIdleTimeoutSec) Dec 11, 2019 at 19:04
• Save 8 bytes with 1..15000|%{sleep 2.04mb}. Dec 11, 2019 at 19:09
• Why not sleep 2mb? You'll get a little under 1000 years, but other than that it should be fine, I'd have thought?
– Neil
Dec 11, 2019 at 21:08
• Save yourself an extra byte with 1..15e3 Dec 12, 2019 at 3:19
• or 1..3e4 and sleep 1mb Dec 12, 2019 at 7:45

## 6502 Machine Code on an Apple II, 10 9 bytes

Code is actually platform-independent, other than it relies on the Apple's clock speed of 1.023 MHz for timing.

0000: A2 CA F6 44 F0 FB D0 F8 F7

0059: A2 08 F6 60 D0 FA CA D0 F9 F5

Disassembly:

loop1: 0059- A2 nn     LDX #$nn ; 2 cyc loop2: 005B- F6 60 INC$60,X  ; 6 cyc
005D- D0 FA     BNE loop1  ; 2-3 cyc
005F- CA        DEX        ; 2 cyc
0060- D0 F9     BNE loop2  ; 2-3 cyc
0062- pp        DB  $pp ; data byte  This is a fairly simple routine that increments a multi-byte counter. When the counter rolls over, the last branch instruction gets modified so that it points to an RTS instruction, which provides the exit for the routine. loop1 is taken for each increment of the counter and takes 11 cycles per iteration. loop2 is taken for each byte carried over and takes 13 cycles per iteration. So if we increment the counter N times, we spend approximately: 11*N + 13*(1/256 + 1/(256^2) + 1/(256^3) + ...)*N = 11.05*N cycles 1000 years is 365242*86400*1023000 = 32282717702400000 cycles So we need N = 2921512914244345 +/- 10% Or a range of 2629361622819911 - 3213664205668779 = 0x095763F583A447 - 0x0B6ACF816801AB In the code above, set pp = 0xF5 and nn = 0x08. This gives us a 7-byte counter in memory locations 0x62-0x68 (with MSB at lowest address, i.e. big endian). Only location 0x62 is initialized, so our starting counter value could be anywhere from 0xF5000000000000 to 0xF5FFFFFFFFFFFF. We'll increment the counter until it rolls over to 0, which will cause the byte at 0x61 to increment by 1, which happens to be the branch target for loop2. On the first byte carry after rollover-- when the counter hits 0x100-- we'll hit the modified branch instruction for the first time. This will take us to address 0x5C (loop2+1). The 0x60 byte there is the opcode for "Return from Subroutine" (RTS) which provides our exit. So our total loop count is between, 0x0A000000000101 and 0x0B000000000100, which is a subset of the range we calculated which gives us the necessary number of cycles +/- 10%. Now that we have the exact starting and ending counter values, we could go back and calculate the exact cycle counts, but given how much margin there is, I'm willing to hand-wave that part. You can actually test it out with smaller values of nn. For example nn of 4 will pause for several seconds. ### 9-byte answer: 0000- A2 CA LDX #$CA   ; 2 cyc
0002- F6 44     INC $44,X ; 6 cyc 0004- F0 FB BEQ$0001  ; 2-3 cyc (rollover)
0006- D0 F8     BNE $0000 ; 2-3 cyc (non-rollover) 0008- F7 DB$F7    ; data byte


Saved one byte by folding the DEX opcode into the argument for LDX.

Instead of 11.05 cycles, each counter increment is now 13 + 11*(1/256 + 1/(256^2) + ...) = 13.043 cycles.

Now we need 2475073064976549 +/- 10% iterations, or a range of 0x7E9F591BF7A2E - 0x9AC2C23EA071C.

So now we initialize the 7-byte counter to something between 0xF7000000000000 and 0xF7FFFFFFFFFFFF. This ends up giving between 0x08000000000001 and 0x09000000000000 loop iterations, which is within the +/-10% needed.

When the counter rolls over to 0, the last branch gets modified to jump to $0001, which leads to an increment of the BNE opcode itself (to a CMP instruction, which for our purpose is effectively a no-op). Code then falls through to$0008, which now contains a 0 (because of counter rollover). A 0 byte is a BRK instruction, which drops you back to the system monitor, ending the routine.

# 05AB1E, 6 bytes

27;°.W


Inspired by the other answer in 05AB1E.

Waits for 1027/2 milliseconds, or about 1002 years.

Explanation:

27            push the number 27
;           divide by 2
°          replace X by 10 to the power of X
.W        wait that number of milliseconds


Try it online!

• Can you explain this a bit more? How does that translate to 10^(27/2)? Dec 12, 2019 at 17:19
• Nice approach! I actually just found another 6-byter myself as well. :) Dec 13, 2019 at 12:53

# Jelly, 8 bytes

32œS$ȷ9¡  Try it online! A niladic link which waits for 32 seconds 1 billion times. 32,000,000,000 is within 10% of 31,557,600,000 seconds which is 1,000 years (ignoring leap seconds and ignoring the fact that centuries indivisible by 400 are not leap years). # Charcoal, 7 bytes Ｆ³³ＲＸφ⁴  Try it online! Link is to verbose version of code with a speed up factor of 1e9 (obtained by changing the ⁴ into a a ¹) so that it doesn't time on TIO. Explanation: Ｆ³³  Repeat 33 times. ＲＸφ⁴  Refresh the screen, but delay 1000⁴ milliseconds between refreshes. Although there are 33 refreshes, there are only 32 intervals, so the total delay is 32000000000000 milliseconds or approximately 1015 years. • I love the implications of “Try it online!” It was the year 12019, and the ancient computer finally woke up. Amazed, the engineers used the methods of long-dead programmers to find what was running. The computer said, Charcoal. The gods had spoken, and in that moment, programming became an important force in the world once again. Dec 12, 2019 at 4:40 • @BalinKingOfMoria 1000 years after now is 3019, not 12019 ;) Dec 12, 2019 at 5:16 • @OmegaKrypton The code sleeps for almost 1015 years anyway, so it would wake up some time during 3034. – Neil Dec 12, 2019 at 9:23 • @OmegaKrypton Oooops, I misremembered it as 10,000 years facepalm Dec 12, 2019 at 17:12 • I can't stand cryptic or archaic languages and would prefer everyone forget about them and use ones that are more readable (maybe Charcoal is and this is just an (ab)use of it?), but this still gets +1 for the effort even though it makes me cringe. Dec 12, 2019 at 17:14 # Java (JDK), 23 bytes v->Thread.sleep(7L<<42)  Try it online! It's hard to find a short way to write a number in Java. Thread.sleep only accepts a long number of milliseconds. So the standard answer 3e10 doesn't work because it's a double. Casting it to a long would be the appropriate action. But it would still be 1000 too small. So enter 3e13 which is closer. But fortunately, 7L<<42 is 30,786,325,577,728, which is close to the actual count of 1000 years, and is a long without cast, so 4 bytes shorter than (long)3e13. ## Credits • -4 bytes thanks to Neil by replacing (long)3e13 with 7L<<42. • @XtremeBaumer No: 3*10^13 = 19. Surely we want to sleep for more than 19 milliseconds. The ^ operator is the binary xor. There is no power operator in Java. Only Math.pow which also returns a double and therefore requires a cast, increasing the total byte count, not decreasing it. Dec 12, 2019 at 13:42 • Does this count here without alle the main class and the try catch for the interruption exception? Dec 12, 2019 at 14:10 • @avalancha Consensus is that lambdas are fine. You don't need to try/catch in lambdas since it relies on declaring interfaces that do all that for you. That's why I declared the Sleeper interface in my TIO. We're using several distinct rulings to get this far in golfing in Java. Dec 12, 2019 at 14:17 • Can you use 7L<<42? It's about 3e13, I think. – Neil Dec 13, 2019 at 0:41 • @DmitryKamenetsky It's a lambda. Oct 26, 2020 at 8:23 # Batch, 41 25 bytes -8 bytes thanks to AdmBorkBork -6 bytes thanks to ceilingcat -2 bytes thanks to inspiration from Neil ping 1 -n 31556952000>nul  Using 31,556,952 seconds / year and a (default) 1 second delay between each ping, this will wait 1000 years before returning nothing. Note that ping 1 results in failure but it'll fail 31 billion times so that still works. • How about 1.1.1.1 to save two bytes? Sure, it's not a valid "test" address (sorry, Cloudflare), but hey, it's code-golf. ;-) Dec 11, 2019 at 20:19 • Actually, more than that, because you can therefore do -n 31556952000000>nul and skip the -w, since there's a one second delay between each ping. Dec 11, 2019 at 20:33 • Why not 1.0.0.1, which abbreviates to 1.1? – Neil Dec 11, 2019 at 21:09 # APL (Dyalog Unicode), 9 8 bytesSBCS -1 thanks to Eric Towers. Full program. This works by observing that $$\sum_{n=1}^{8^6}n=3.44×10^{10}\approx3.16×10^{10}$$which is the number of seconds in a thousand years. ⎕dl¨⍳8*6  Don't try it online! 8*6$$\8^6=262144\$$ ⍳ɩntegers until that ⎕dl¨delay each of those many seconds • I don't know APL, but is ⎕dl¨3e10 good for 8 bytes? Dec 11, 2019 at 23:31 • @79037662 ¨ is "each" which wouldn't be needed in this case, but no, 3e10 is for some reason too big an argument for ⎕dl which appears to have a limit of 2147483 seconds. – Adám Dec 11, 2019 at 23:37 • 8*6 = 262144, giving 1088.8... years. Dec 13, 2019 at 4:07 • @EricTowers Incorporated. Thanks! – Adám Dec 13, 2019 at 8:13 # Wolfram Language (Mathematica), 11 bytes Pause[2^35]  2 to the 35th power is about 8.9% greater than 31,556,926,000. • I’m not at my computer right now to check, but can you save a byte with Pause@2^35 ? Dec 15, 2019 at 0:15 • Tried that—it pauses for 2 seconds and returns Null^35 :D Dec 15, 2019 at 8:23 # R, 24 bytes sapply(1:25e4,Sys.sleep)  Try it online! A solid starter, feels like there's optimisation to be had with a different function & number combo. This sleeps for 1s, then 2s, then 3s, then 4s... up to 250000s, at which point it's been running for about 990 years and outputs a list of 250k empty elements. • why not 3e10 like the other answers – qwr Dec 12, 2019 at 22:09 • @qwr Sys.sleep(3e10) doesn't work, and I couldn't figure out a shorter way to write some version of for(i in 1:3e10)Sys.sleep(1) that works. If there is one then more fool me! Dec 13, 2019 at 9:52 • @qwr it occurred that there's a less obvious reason for this being the shortest one I found: 25e4 is the same length as 3e10, but sapply allows us to pass the counter into the function without parentheses making it valuable to find a number with sums along to roughly 3e10. The 1:25e4 is doing double duty here. Dec 13, 2019 at 10:42 • why doesn't Sys.sleep(3e10) work? – qwr Dec 13, 2019 at 18:49 • I'm not 100% on the why of it, but the documentation says on Windows Sys.sleep uses Sleep. I'm not knowledgeable of the specifics there, but the outcome is that it sleeps for a few milliseconds rather than a thousand years. Might behave differently on Linux? Dec 19, 2019 at 12:18 # T-SQL, 56 bytes DECLARE @ INT=0a:WAITFOR TIME'9:0'SET @+=1IF @<4E5GOTO a  • The SQL WAITFOR command is limited to 24 hours, so it has to go in a loop. • WAITFOR has two options: DELAY that waits a certain length of time, or TIME which waits until a certain time of day. Turns out WAITFOR TIME'9:0' (which will pause until 9am the following day) is a couple of bytes shorter than WAITFOR DELAY'24:0'. • Using a GOTO loop is shorter than a WHILE loop. • I'm looping 4E5 times (400,000), which is within 10% of the 10-year (365,242 day) goal. • If I start it today, this would complete in February, 3115 # Lua, 38 bytes t=os.time;o=t()+2^35while t()<o do end  Try it online! Being ANSI C compliant, Lua does not implement any sleep functions, so we have to make one ourselves. Oh, and make sure to keep the dust off that One Thousand Year Computer, we're busy waiting. # Lua, 38 bytes t=os.time;o=t()+2^35repeat until o<t()  Try it online! Same thing, different loop. Tried to see if I can save some bytes, but nope. • What the dingle bells, why does 35while not throw the parser into conniptions? Today I learned something about Lua I didn't want to know. Dec 13, 2019 at 5:41 • @Caleb In upcoming Lua 5.4, this will no longer works. They have learnt this lesson. Also, tio.run really should provide different Lua versions due to significant changes (this one will cause a lot of 5.3 golf break if they'll just update). Dec 13, 2019 at 11:04 # C# (Visual C# Interactive Compiler), 59 bytes b=>{for(var d=DateTime.Now.AddYears(999);d>DateTime.Now;);}  Can be tested by replacing AddYears() with AddSeconds() Try it online! • Couldn't this be shortened by eliminating 'd' and making the 'for' a 'while'? – bta Dec 14, 2019 at 2:06 • @bta you mean while (DateTime.Now.AddYears(999) > DateTime.Now); ? but that would result in an endless loop, as if I don't initially store DateTime.Now in a variable it will keep updating its value. Dec 14, 2019 at 12:18 • 54 - you don't need to wrap the code in a function. – dana Aug 19, 2020 at 13:41 ## Mumps (M): 7 Bytes H 9**11  Mumps likes single-letter commands & big numbers... H(ang) sleeps for ## of seconds; 9 to the 11th power gives 31381059609 seconds, which is almost 0.6% low for 1000 years; well within the margin of error. Keeping with the 7 byte code length, I tested "power of 9" sleep times on 2 different Mumps implementations; the largest power of 9 on YottaDB/GT.M I can find without numeric overflow would be: H 9**49  which gives a sleep time of just over 1,814 decillion millennia. InterSystems' Cache doesn't overflow and can go to: H 9**99  which gives 9.352x1083 millennia. That's quite a nap in 7 bytes! # Pyth, 10 bytes VT.dC"¼€  Try it online! There are exactly 31,557,600 seconds in the Julian astronomical year., totalling 31,557,600,000 seconds in 1000 years. 2^32 is about a tenth of this, so we just wait for 3,155,760,000 seconds ten times. Note that € is a blank codepoint in the TIO, not sure why it translates to this on SE Here you can see that C"¼€ is equal to 3,155,760,000 And here is an example that waits for only 22 seconds using a similar method # Pyth, 8 bytes .dC"XúÃ  Try it online! Alternatively, this one just uses C"XúÃ for 31,557,600,000. I thought it was more in line with the spirit of the challenge to have a 2^32 limit, though The average length of a sidereal year, however, is 365.256363004 days or around 31,558,149.763 seconds, giving us a total of ~31,558,149,764 seconds in 1000 years. In this case, the more accurate solution would be This: VT.dC"¼ê@ This:.dC"Y&ƒ(1 byte longer than Julian solution) # Perl 5, 18 bytes sleep 1e9for 1..30  Try it online! 10 bytes (doesn't work) sleep 3e10  Try it online! • Polyglot with Perl 6/Raku – Jo King Dec 12, 2019 at 7:46 • actually it doesn't work : sleep() with negative argument Dec 13, 2019 at 6:40 # PHP, 30 bytes The time() function can be used instead of microtime(1), as when plused with 3e10, PHP converts the value into a float, even when the original value is an int and thereby save some more bytes. time_sleep_until(time()+3e10);  See how php converts values As stated by "manassehkatz-Reinstate Monica" a flag can be set to make it run without the tags in PHP, so a more clean version is here made. (36 bytes) time_sleep_until(microtime(1)+3e10);  Google tells me that 1000 years = 3.1556926 × 1010 seconds (31,556,926,000) The method cloud even be made recoverable in the event of power failures. (not done in this example) <?php time_sleep_until(microtime(true)+31556926000)); ?>  The shorter but more imprecise version (45 bytes with the php tags) <?php time_sleep_until(microtime(1)+3e10); ?>  With a correction from "Kaddath" this option below is dropped as the documentation state that it is a int not a float used in sleep() It can be done like so: <?php sleep(31556926000); ?>  Try it online! • I love how you've added a "Try it online!" link :') Dec 12, 2019 at 9:35 • I think it would work with 1+"3e10" which saves 3 bytes ;) (automatic conversion to float and actually 31556926000 is already a float, not an int) Dec 12, 2019 at 10:02 • Well after having tested, my previous comment's suggestion doesn't work, but that means yours will not either: sleep converts argument to an int, so the value used will be 1492154928 when you use 31556926000, which is "only" 47.3 years (hard to verify, I know, must trust the documentation on this).. Sorry! Dec 12, 2019 at 10:27 • However, the second code with time_sleep_until will work, because it uses a float, and there you actually can use microtime(true)+"3e10".. EDIT: even better: microtime(1)+"3e10" Dec 12, 2019 at 10:32 • Congrats Mikki! Thanks for representing PHPers! PS: do you really need the closing tag ?>? ;D Dec 12, 2019 at 15:15 # C# (Visual C# Interactive Compiler), 38 37 bytes this waits 1 + 2 + 3.. +77e5-1 + 77e5ms. I got this 77e5 magic number using the formula (x+1)/2*x=3e13 where x results in approximately 7.745.967 which I shortened to 77e5. To check if it still falls in the allowed range I did 1000*365.25*24*3600*1000/((77e5+1)/2*77e5) which is 1.064 aka 6.45% of target update : 8e6 results in 0.98 more precise and less bytes. for(var i=0;i++<8e6;)Thread.Sleep(i);  Try it online! # JavaScript (Node.js), 70, 67, 34 bytes -3 thanks to Joost K, see their answer for why I used 8e6 -33 thanks to Benjamin Gruenbaum for pointing out callbacks are better, using the concept of his answer I've found 2 ways of solving this problem. The first defines a globally: (f=_=>a&&setTimeout(f,--a))(a=8e6)  the other method passes a through each time, using setTimeout's further args: (f=a=>a&&setTimeout(f,--a,a))(8e6)  These solutions remain the same length when using IIFEs or just calling the function manually. • You can remove the space to save another byte :) Dec 13, 2019 at 13:04 • you can cut down 3 bytes by changing the loop like t=77e5;--t; and using t as the time to wait.setTimeout(r,t) See my C# answer where I use this in C# Dec 13, 2019 at 13:39 • @JoostK Clever, I'll add that in now, thanks :) – Kobe Dec 13, 2019 at 14:09 • Same concept but with callbacks instead of promises :] (function f(a){setTimeout(f,--a)})(8e6); at 40 characters Dec 13, 2019 at 19:13 • @BenjaminGruenbaum Wouldn't this carry on forever? and isn't a undefined? – Kobe Dec 17, 2019 at 9:55 # TI-BASIC, 17 bytes For(I,0,2^32:rand(564:End  TI-BASIC doesn't have any wait commands/functions, so I just used one of the slowest functions available: generating random lists! Generating a random list of 564 elements takes $$\\approx7.95\$$ seconds to make and the loop goes through $$\2^{32}\$$ iterations, so that results in $$\7.95*2^{32}=34144990003.2\$$ seconds or $$\1082.01255\$$ years. # Matlab, 12 bytes pause(3e+10)  This will sleep for 951 years which is within 10% of 1000 years. Note that Matlab can sleep for a floating number of seconds. This is my first ever answer on CodeGolf :) # Applescript, 10 delay 3e10  Sleeps for 3 * 1010 seconds. # 05AB1E, 7 6 bytes 35oF.Z  ~8.879% too large Also take a look at this excellent alternative 6-byter by @anatolyg. Previous 7-byters: žqþ¨¨.W # ~0.449% too small žG14∍.W # ~3.837% too large 13°3*.W # ~4.936% too small  For 100% precision (: assuming a year is 365.25 days), use •Tε‚šä¦•.W (10 bytes) instead. Explanations: 35 # Push 35 o # Pop and push 2 to the power 35: 34359738368 F # Loop that many times: .Z # And sleep for 1 second every iteration žq # Push PI with 15 decimal digits by default: 3.141592653589793 þ # Remove the dot by only leaving the digits: 3141592653589793 ¨¨ # Remove the last two digits: 31415926535897 .W # Sleep that many ms žG # Push builtin integer 32768 14∍ # Extend it to size 14: 32768327683276 .W # Sleep that many ms 13° # Push 10 to the power 13: 10000000000000 3* # Multiply it by 3: 30000000000000 .W # Sleep that many ms •Tε‚šä¦• # Push compressed integer 31557600000000 .W # Sleep that many ms  See this 05AB1E tip of mine (section How to compress large integers?) to understand why •Tε‚šä¦• is 31557600000000. 05AB1E is built in Elixir, and its sleep builtin can even hold :infinity apparently, so I can assume the .W has no maximum. • 5 bytes: ₆9e.W (waits ~8% too long). Dec 13, 2019 at 13:50 • @Grimmy Nice, I knew 5 bytes should be possible somehow with some of the 1-byte constants and 1-byte builtins! I was playing around with palindromize, factorize, euler_constant, etc. but forgot about e. Feel free to post it as your own answer in this case, since there are already two 05AB1E answers and my answer is already a bit too full (don't really want to remove the 7 byters). I'll upvote you when you do. Dec 13, 2019 at 13:52 # 05AB1E, 5 bytes ₆9e.W  Sleeps for about 1082 years. Try it online! ₆ # push 36 9 # push 9 e # nPr (number of 9-element permutations of a 36-element list) .W # wait that many milliseconds  # x86-64 function, 10 bytes 6A 16 59 48 C1 E1 1F E0 FE C3  In assembly: sleep_for_a_thousand_years: push 0x17 pop rcx shl rcx,52 loopnz$
ret


This is a function

The loopnz opcode decrements the rcx register and jumps if the zero flag is not set and rcx!=0 after it is decremented. \$ denotes the address of the loopnz address itself, so this just loops back to the same instruction over and over until rcx is zero.

loopnz is infamously slow, and the code before sets rcx` to 103,582,791,429,521,408. So this will loop 103,582,791,429,521,408 times, which should take 1012 years, based on some benchmarks I did on TIO. (The number may need to be tweaked a bit if you have some overclocked monstrosity though.)

Try it online! ... Actually, maybe skip that just this once.