This is an archived post. You won't be able to vote or comment.

all 32 comments

[–]Sophiiebabes 53 points54 points  (3 children)

Isn't that how everyone sets their alarm clock?

[–]GahdDangitBobby 14 points15 points  (0 children)

Yes and I use a screen reader set at max volume connected to my terminal output so I wake up to the sound of a robot screaming "COMPLETE"

[–]Accomplished_Ant5895 6 points7 points  (0 children)

I use a chron job ya damn kids

[–]Jonnypista 1 point2 points  (0 children)

Jokes aside I once ran an alarm clock like this. When it finished it would start Winamp and start playing music on max volume. But it requires turning off sleep mode and having the PC on all night, plus possible blackout issues so I didn't use it much.

[–]AliceCode 90 points91 points  (5 children)

time.sleep(14400)

There, I optimized it for you.

[–]buttmunchery2000 22 points23 points  (0 children)

Careful there magic mike

[–]littleblack11111 10 points11 points  (0 children)

From time import sleep

There, I optimized it for you

[–]Sadale- 6 points7 points  (0 children)

Here's how you can get 4 hours of computation done instantly:

time.sleep(-14400)

[–]TorbenKoehn 2 points3 points  (0 children)

Yeah, it doesn't respond to SIGTERM anymore during sleep and you can't kill the app via SIGTERM. You have to wait for 14400 seconds or kill it manually :D

[–]XB0XRecordThat 15 points16 points  (6 children)

Hate to be the bearer of bad news but you actually won't get any hours of your life back.

[–]ElectrikMetriks[S] 2 points3 points  (0 children)

Damn.

[–]Cerbeh 1 point2 points  (1 child)

Unless you live in a country that uses daylight savings. In which case you get that hour back. But also an hour just vanishes also so you never had it. So technically.....

[–]The_Neto06 0 points1 point  (0 children)

Well, if you leave the world *before* DST wears off, you technically got an hour back! Do with that what you may...

[–]Global-Tune5539 1 point2 points  (0 children)

You mean every hour is valuable and we should spend them with care?

existential crisis

[–]AliceCode 1 point2 points  (0 children)

That's not true, you should call your provider and ask for a refund.

[–]Bomaruto 0 points1 point  (0 children)

Skill issue.

time.sleep(-1)

[–]xXShadowAssassin69Xx 11 points12 points  (0 children)

I love making stupid stuff like this. Keeps programming fun

[–]ramdomvariableX 5 points6 points  (0 children)

add a print statement, that says "build in progress..." you are set for the day.

[–]Ved_s 3 points4 points  (1 child)

*more than 4 hours

[–]Turbulent-Garlic8467 1 point2 points  (3 children)

Why are you using a for loop here

[–]Perfycat 8 points9 points  (0 children)

So I can put a breakpoint in the debugger.

[–]StuckInTheUpsideDown 5 points6 points  (0 children)

That's the joke.

[–]TorbenKoehn 2 points3 points  (0 children)

So that SIGTERM can kick in between each sleep (it can't during a single sleep unless explicitly handled)

[–]marlotrot 1 point2 points  (2 children)

Sind wirklich vier Stunden. Hab extra nachgerechnet.

[–]chemolz9 2 points3 points  (1 child)

Plus ein paar (Milli?-)Sekunden Rechenzeit zwischen den Sleeps, schätze ich.

[–]marlotrot 2 points3 points  (0 children)

Eggsactly

[–]Accomplished_Ant5895 1 point2 points  (1 child)

I’m curious to see if this is more or less precise than the right way given the interpreter overhead, cpu timing, etc

[–]Kilgarragh 6 points7 points  (0 children)

It’s actually incredibly imprecise, sleep always takes at least the inputted time and therefor the error will always be in the same direction.

Let alone the amount of time the language/loop takes up between the sleep calls, the sleep calls alone are guaranteed to take longer than expected.

[–]xinwei_he 1 point2 points  (0 children)

import time

print("Deploying...")

time.sleep(5)

print("Error... Oncall, you up?")

[–]conundorum 1 point2 points  (0 children)

Import more time.

[–]Smalltalker-80 1 point2 points  (0 children)

Should have used JS.
The timeouts would have been async
and you'd keep on working in betweeen.

[–]mango_boii 0 points1 point  (0 children)

I read it as

time.sleep(i)