How many dates?



  • in a relatively tight loop (and repeated numerous times for various cache timeouts):

    if ( ((new java.util.Date().getTime()) - cacheRefreshTime) > 5400000) {
    // refresh cached info from the dbase
    cache = cacheController.update();
    cacheRefreshTime = new java.util.Date().getTime();
    }
     



  • According to the Quantum Zeno Effect, running this with an active observer watching the output of getTime might be able to stop time altogether, if not slow it down.



  • I get really tired of discovering how poorly my predecessors knew Java:

    private Date epoch = null;
    .
    .
    .
    public void setEpoch(Date newEpoch) {
    if ( newEpoch == null) {
    this.epoch = null;
    } else {
    this.epoch = new Date( newEpoch.getTime() );
    }
    }
    Or, maybe, they were creating defensive copies so that no one would mess with the private epoch (since Dates are mutable)? Hah! Bloody unlikely...



  • @hoodaticus said:

    According to the Quantum Zeno Effect, running this with an active observer watching the output of getTime might be able to stop time altogether, if not slow it down.

    Reminds me of one of my son's FB posts about the new Oven/Stove we got when moving in to our new home. The programming features of the oven allow you to set it and forget it (:twitch:) ... one of the buttons is 'Stop Time' ... he said he was afraid to hit the button for obvious reasons.



  • I hope I never meet the warped mind that wrote setEpoch.  And that's not just a java wtf; that's a WTF in any language, even the ones that aren't OO.



  • @zelmak said:

    @hoodaticus said:

    According to the Quantum Zeno Effect, running this with an active observer watching the output of getTime might be able to stop time altogether, if not slow it down.

    Reminds me of one of my son's FB posts about the new Oven/Stove we got when moving in to our new home. The programming features of the oven allow you to set it and forget it (:twitch:) ... one of the buttons is 'Stop Time' ... he said he was afraid to hit the button for obvious reasons.

    ... except that he habitually hits it the moment you get to work.



  • @hoodaticus said:

    I hope I never meet the warped mind that wrote setEpoch.  And that's not just a java wtf; that's a WTF in any language, even the ones that aren't OO.
    It would be perfectly valid if Date were mutable.



  • @Sutherlands said:

    It would be perfectly valid if Date were mutable.
    And if they weren't using "new", of course.



  • @Matt Westwood said:

    ... except that he habitually hits it the moment you get to work.
    The sun never sets on British wit.



  • @hoodaticus said:

    @Sutherlands said:

    It would be perfectly valid if Date were mutable.
    And if they weren't using "new", of course.

    Huh?  Since they're not mutable, you can just do:

    public void setEpoch(Date newEpoch)

    {

       this.epoch = newEpoch;

    }

    If Date was mutable, you would have to create a new Date based on the old one, and you would have to check for null first.



  • I was being shallow and pedantic; I thought you knew.

     



  • @hoodaticus said:

    I was being shallow and pedantic; I thought you knew.

    I don't get what you were being pedantic about.



  • @zelmak said:

    Reminds me of one of my son's FB posts about the new Oven/Stove we got when moving in to our new home. The programming features of the oven allow you to set it and forget it (:twitch:) ... one of the buttons is 'Stop Time' ... he said he was afraid to hit the button for obvious reasons.

    There's an easy fix for that:

    Stop ^Hammer Time

     



  • @Sutherlands said:

    @hoodaticus said:

    I hope I never meet the warped mind that wrote setEpoch.  And that's not just a java wtf; that's a WTF in any language, even the ones that aren't OO.
    It would be perfectly valid if Date were mutable.

    Actually, in Java, Date objects ARE mutable. Much of the mutability has been deprecated, but Date.setTime(long) is still viable.



  • @zelmak said:

    The programming features of the oven allow you to set it and forget it (:twitch:) ... one of the buttons is 'Stop Time' ... he said he was afraid to hit the button for obvious reasons.
     

    Not to worry.  The button is merely the product of a miscommunication between the designer of the oven and the subcontractor fabricating the labels.  It's actually supposed to say "EMIT POTS", and you press it whenever you want the pots to come out of the oven at the end of a cooking cycle.



  • To answer the OP's question: "Not enough, apparently".



  • @Matt Westwood said:

    @zelmak said:

    @hoodaticus said:

    According to the Quantum Zeno Effect, running this with an active observer watching the output of getTime might be able to stop time altogether, if not slow it down.

    Reminds me of one of my son's FB posts about the new Oven/Stove we got when moving in to our new home. The programming features of the oven allow you to set it and forget it (:twitch:) ... one of the buttons is 'Stop Time' ... he said he was afraid to hit the button for obvious reasons.

    ... except that he habitually hits it the moment you get to work.

    Which means the oven is either (a) brand new or (2) timeless.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.