Skip to content

Java assertion to prevent time travelers

cc broken pocket watches
Creative Commons photo by jekemp

public class PreventTimeTravelers {
    public static void main(String args[]){
        long startTime = System.currentTimeMillis();
        long endTime = System.currentTimeMillis();
        assert endTime >= startTime: "We came back in time!";

Please do not execute this code in a time machine.

Published inenglish

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *