Java won't let me time travel

(This isn’t an actual question, this is just a little joke)

In my game I’m trying to go back in time by a few seconds but I keep getting this error:


java.lang.IllegalArgumentException: timeout value is negative
	at java.lang.Thread.sleep(Native Method)
	at Ideone.main(Main.java:14)

My code:


try {
    Thread.sleep(-1000);
} catch (Exception ex) {
    ex.printStackTrace();
}

Thx in advance…

The trick is not to wait a negative amount of time, but to wait so long that the universe collapses back into itself, creates another big bang, and repeats up until the point you want to go back to.

What could possibly go wrong?

Hey don’t pretend you got it all figured out :smiley:
The big crunch is only one possible outcome.
As for observation, it really doesn’t seem like the universe will contract again.
Your wait might be in vain, incase of heat death or big rip or what have you.

Haha!

Guess I’ll just keep my fingers crossed for the singularity then!

http://lovatron.com/wp-content/uploads/2014/02/i-see-what-you-did-there-rage-face-meme.jpg

Oh waaaiit… Ofcourse it doesn’t let you time travel.
You forgot:

import java.awt.delorean.fluxCapacitor

and

import java.swing.fancyTimeTravelSwirlyEffects

I’ve travelled in time before, no big issue. (Probably won’t mention I only travelled into the future (I mean: aren’t we all?))

Nah, delorean is an outdated and clunky old technology. Try tardis instead, its better.

I guess my Java knowledge is outdated and clunky too xD

try this


try {
    Thread.unSleep(1000);
} catch (Exception ex) {
    ex.printStackTrace();
}

and then in Eclipse hit Alt-F4 to open the auto completion

You’re doing it wrong.

Comment out the indicated line:


try {
    Thread.sleep(-1000);
} catch (Exception ex) {
    // ex.printStackTrace();
}

See? No more errors!

Oh and assuming that you’re using the outdated and clunky way, the correct parameter should be:



import java.awt.delorean.fluxcapacitor

try {
    Thread.sleep(-88);
} catch (Exception ex) {
    ex.printStackTrace();
}

I don’t recall them having to drive backwards…

Although this is driving straight into the maw of The Monster.

LocalDateTime.now().minusYears(10);

Why not this way?

Well, it’s all about perspective. I tried to make clear how my theory about using the old fashioned way of importing the flux capacitor from the delorean package was a workaround in order to get done what was needed.

However I do believe that if the delorean drove backwards in the movies it would’ve still worked. I think it wasn’t so much a thing of the forward speed, but just the speed. Driving either way at 88 miles per hour would’ve created enough energy to be able to power the flux capacitor. Ofcourse I don’t know anything about these flipping swift technological advancements, so it’s only a rant on a theory I just made up.

No, no, no. It’s like this


import java.secretpackage.timetravel.*;

try {
      TimeMachine.startEngine();
      Year.setYear(1967);
      RedButton.seeYaSuckas();
} catch (VortexException)  {
    Ahhhh.runForTheHills();
}

I know it is not an official API, but you can generally use com.sun.time.TimeUtil.initTime(long millis). It’s a quick way to implement save games, just set the player’s time back by half an hour or so. Negative values aren’t allowed so it only goes back as far as the Unix epoch.

@DarkCart: What classes are startEngine, seeYaSuckas and runForTheHills in? Did you forget to mention some static imports or are they personal functions?

I think that he forgets some static imports :smiley:

There’s your problem, you forgot one crucial aspect:


try {
    Thread.sleep(0-(1/0));
} catch (Exception ex) {
    ex.printStackTrace();
}

I like to think our computers get all moody when we try to compile code like this.

“Oh god, again?? He knows that won’t work right? Stupid programmer.”