• Dr. Who (unregistered) in reply to mace
    mace:
    But it's still a dinky gambling website. Who would reconfigure their system based on instructions from some shady website? I sure wouldn't, and if you would, welcome to the wonderful world of botnets and spyware.

    Assuming facts not in evidence. Check your own Windows system's time configuration if you don't understand this. No reconfiguration of the client is necessary.

    And besides, you're running javascript from this "shady website" and somehow you're concerned about instructions for (a nonexistent) configuration for time server change?

  • odsquad64 (unregistered)

    You'll notice there's no clock on the Time Cube website. It's hard enough to accommodate for time zones, much less four days occurring simultaneously.

  • (cs)

    The real WTF is how long they spent getting the feature working right, instead of just rolling back the production server to take the bad feature out of production. (Not to mention failing to load test the new feature)

  • (cs) in reply to iToad
    iToad:
    RayMarron:
    Why do people still insist on putting little clocks on their websites and programs? Everyone is *FREAKING SURROUNDED* by clocks! In your tray, on your phone, on your wrist, on the wall...
    You can never have too many clocks. From where I'm setting, I can see six of them (counting my watch).
    Cue opening scene from "Back to the Future".
  • Patrick (unregistered)

    Man, if I was David, that would be a Gibbs moment right there. "Javascript has a built-in Date object?" ::THWAP::

  • emptyset (unregistered)

    I suppose nobody liked THE CLOCK THAT CAME WITH THEIR OS.

  • (cs) in reply to jspenguin
    jspenguin:
    Here's The Real WTF(TM): setInterval creates a recurring timer: every call to updateClock creates another 1-second clock. So, the initial call to updateClock (from the onload attribute) creates the first timer. When that timer calls updateClock again, it creates another timer. One second later, both timers call updateClock, which creates 2 more timers, etc.

    The number of calls to the server grows exponentially while the page is left open. This will not only bring the network to its knees, it will drag down the systems running this script, too.

    Nice idea, though I don't think it would work. Just did a few tests on an Intel Core 2 Duo machine with 1024MB RAM and a loop like that brought Firefox to a screeching halt in less than five seconds. Which would, ironically, keep the server from getting DDoSed.

    Then again, do we know the percieved "intranet slowness" came really from the intranet...? hmmm...

  • Dr. Who (unregistered) in reply to PSWorx
    PSWorx:
    Then again, do we know the percieved "intranet slowness" came *really* from the intranet...? hmmm...

    Good question. Maybe it's really from the electrons in this space-time continuum leaking into another one nearby.

  • justsomedude (unregistered) in reply to Connect to Reality
    Connect to Reality:
    Next time, I'm going to skip reading the article so I can post frosttt. Also, this makes me wonder if what I'm doing with AJAX is ok.

    I'd give up all the new fancy app-like web designs if we could just put ajax back into the ground from whence it came.

    AJAX/JS is just too damn dangerous, completely changed the name of the game with respect to malicious code.

  • Zapp Brannigan (unregistered) in reply to emptyset
    emptyset:
    I suppose nobody liked THE CLOCK THAT CAME WITH THEIR OS.
    Mine's still flashing Jan 1 1980 12:00:00 AM
  • (cs) in reply to edric001
    edric001:
    a browser has a build in scripting language ???

    No.

    (The more people we can convince, the better the WWW will be.)

  • (cs) in reply to Anonymous
    Anonymous:
    A man with one clock knows what time it is. A man with a watch, phone, tray clock, MP3 player, and cell is never sure.

    I have six! I AM THE TIME MASTER!

  • Anonymous (unregistered) in reply to emptyset
    emptyset:
    I suppose nobody liked THE CLOCK THAT CAME WITH THEIR OS.
    You mean the clock that came with their motherboard. The O/S has no built-in time keeping ability of its own. Sorry, pedantry!
  • Mr^B (unregistered) in reply to steenbergh
    steenbergh:
    Tempus fugit; time flies like an arrow, and fruit flies like bananas.

    "...fruit flies like a banana."

    If you're going to quote Marx, get it right!

  • Bim Job (unregistered) in reply to justsomedude
    justsomedude:
    Connect to Reality:
    Next time, I'm going to skip reading the article so I can post frosttt. Also, this makes me wonder if what I'm doing with AJAX is ok.

    I'd give up all the new fancy app-like web designs if we could just put ajax back into the ground from whence it came.

    AJAX/JS is just too damn dangerous, completely changed the name of the game with respect to malicious code.

    Well, going by the insane feature abuse documented in the OP, I think it's fair to say that AJAX is the Web equivalent of regular expressions.

    (And before some smart-arse points out that Javascript supports regular expressions, yes, I know it does. At least it's on the client side, so now you only have two problems[tm]. With the magic of AJAX, you can get all the problems you can eat... and then some.)

  • Chris (unregistered) in reply to Anonymous
    Anonymous:
    emptyset:
    I suppose nobody liked THE CLOCK THAT CAME WITH THEIR OS.
    You mean the clock that came with their motherboard. The O/S has no built-in time keeping ability of its own. Sorry, pedantry!
    Once a modern operating system is booted, it no longer relies on the motherboard to keep time. This is the reason why there are switches like --systohc in the hwclock program (to push the current system time to the hardware). I have my system configured to save the system time to the hardware on each shutdown. This enables me to always have a hardware time that is fairly accurate, since my system updates its time with ntpd. The idea that the OS does not have any time keeping ability is stupid; of course it does!
  • monkeyPushButton (unregistered) in reply to Political Suicide
    Political Suicide:
    Capt. Obvious:
    Political Suicide:
    Nah! It would take an act of Congress to get something like that done today.
    To be fair, it took an act of Congress the first time around too.
    Perhaps my joke was a little too subtle.
    Or perhaps Capt. Obvious's username was a little too subtle (I thought the same thing before I notice the username).
  • (cs)

    The same as almost every wtf here

    [image]
  • (cs) in reply to RHuckster
    RHuckster:
    Wait a second (no pun intended)... if this code was truly copied word for word, then it's far, far, worse than calling updateClock once per second... it's in a exponential recursive loop because each time updateClock is being called, it's asking updateClock to be called EVERY second, not just in the NEXT second. In other words, the developers may have caused a Gordon Freeman-like resonance cascade scenario with time. Scary stuff, indeed... never thought you could cause something like that with JavaScript, did you?

    If you can't shoot yourself in the foot with a language, it isn't worth anything. Javascript is worth something and so ... owwwwwww!!

  • An Onymous (unregistered) in reply to ZaM
    ZaM:

    Shouldn't that be something like "TM you must FR"?

  • John P Goodman (unregistered)

    For all those who say "just configure the client with NTP", you apparently have never had a rogue time server take out an entire Windows domain's authentication because Someone Thought It Was A Good Idea To Keep The Client Clocks In Sync With The Faulty Government Time Server*... clock skew is a bitch.

  • Jay (unregistered)

    I think it's totally inappropriate to treat your Date like an Object.

  • justsomedude (unregistered) in reply to Bim Job
    Bim Job:
    ...snip...

    AJAX is the Web equivalent of regular expressions.

    iLOL'd, will have to remember that one ;-)

  • Zapp Brannigan (unregistered) in reply to Jay
    Jay:
    I think it's totally inappropriate to treat your Date like an Object.
    Should a date be treated like property?
  • Americium (unregistered) in reply to steenbergh
    steenbergh:
    Tempus fugit; time flies like an arrow, and fruit flies like bananas.

    Fruit flies also multiply and change quickly, much like this WTF.

  • marklar (unregistered) in reply to tom
    tom:
    actually it should be
    setInterval(function() { updateClock(); }, 1000);
    

    Captcha: vereor

    Two things:

    1. never use setInterval. ever. create your own chaining class if you must, but FFS, use setTimeout.
    2. always send a function pointer to setTimeout, BUT avoid creating extra closures, when you can. jspenguin said it above, use setTimeout(updateClock,1000);
  • JohnFx (unregistered)

    Just thought I'd let everyone know it is 1:01PM Central Time.

    I'll add another comment if this information changes...

  • Dave (unregistered) in reply to Zapp Brannigan
    Zapp Brannigan:
    Jay:
    I think it's totally inappropriate to treat your Date like an Object.
    Should a date be treated like property?
    There's an abundance of evidence that the worse you treat them, the more they like it. You just have to be careful not to treat them so bad that they get addicted to you like meth, and you can't shake them when it is time to move along.

    Yeah, I know, it doesn't make logical sense, but who ever said we are dealing with rational creatures here?

  • foobar2000 (unregistered)

    There are bugs in JS timezone handling...

  • Billy (unregistered) in reply to Bim Job
    Bim Job:
    justsomedude:
    Connect to Reality:
    Next time, I'm going to skip reading the article so I can post frosttt. Also, this makes me wonder if what I'm doing with AJAX is ok.

    I'd give up all the new fancy app-like web designs if we could just put ajax back into the ground from whence it came.

    AJAX/JS is just too damn dangerous, completely changed the name of the game with respect to malicious code.

    Well, going by the insane feature abuse documented in the OP, I think it's fair to say that AJAX is the Web equivalent of regular expressions.

    (And before some smart-arse points out that Javascript supports regular expressions, yes, I know it does. At least it's on the client side, so now you only have two problems[tm]. With the magic of AJAX, you can get all the problems you can eat... and then some.)

    Gah was going to mention that yes JS has RE. But also will point out that RE is amazing, and AJAX is not. It was fun for a good month or so however!

  • junkpile (unregistered) in reply to edric001
    edric001:
    a browser has a build in scripting language ???

    You mean there's a browser for accessing remote content? I've been using curl with my mental text-to-display translator. This way I can interpret things how I want to instead of how someone else intended. Wait, my brain has been hacked by an xss vulnerability and they stole all my mental cookies...

  • Dan (unregistered) in reply to Dr. Who
    Dr. Who:
    Not sure what universe you're speaking from.

    No ntp client is needed to be installed, and on Windows is most likely already enabled.

    And in my universe, a ONE-TIME-call to the server to tell the time zone of the server IS easy compared to a nearly constant update of the server's clock.

    The average gambling site user either has NTP configured out-of-box or doesn't. You can't depend on it, and you certainly can't depend on the user to fix the configuration if it's not set correctly.

    And for the record, the original suggestion was not to update from the server every second, but once to get a timediff, then update every second using that timediff not the server.

  • Procedural (unregistered) in reply to RayMarron
    RayMarron:
    Why do people still insist on putting little clocks on their websites and programs? Everyone is *FREAKING SURROUNDED* by clocks! In your tray, on your phone, on your wrist, on the wall...

    on eBay (http://viv.ebay.ca/ws/eBayISAPI.dll?EbayTime) ...

  • (cs) in reply to Zapp Brannigan
    Zapp Brannigan:
    Jay:
    I think it's totally inappropriate to treat your Date like an Object.
    Should a date be treated like property?
    Like a member.
  • Frost (unregistered)

    At my old job it was far too (depressingly so) common to see the developers think it was fine to implement a function that worked fine with one user, and then blithely go ahead to production with it without realizing that when several hundred people at a time fired up the page, the servers would give out a death rattle and freeze up under the load. Glad I'm not having to babysit those particular servers anymore.

  • Jimmy Kimmel (unregistered) in reply to Beldar the Phantom Replier
    Beldar the Phantom Replier:
    RayMarron:
    Why do people still insist on putting little clocks on their websites and programs? Everyone is *FREAKING SURROUNDED* by clocks! In your tray, on your phone, on your wrist, on the wall...
    Matt Damon: On the bed, on the floor, on a towel by the door, in the tub, in the car, up against the mini-bar Sarah Silverman: I’m f****** Matt Damon

    Comment if you're f****** Ben Affleck

  • darkmage0707077 (unregistered) in reply to Political Suicide

    It could happen! Just make it an issue of National Security!

  • Mike5 (unregistered) in reply to Connect to Reality
    Connect to Reality:
    Next time, I'm going to skip reading the article so I can post frosttt. Also, this makes me wonder if what I'm doing with AJAX is ok.
    Well, as soon as you wonder, the answer is probably "NO!"
  • Mike5 (unregistered) in reply to Political Suicide
    Political Suicide:
    Anonymous:
    If only there was some sort of always-available resource of information that they could refer to in order to find out more about a given programming language. Like a kind of highway for information. It would be super.

    Nah! It would take an act of Congress to get something like that done today.

    Yeah, that'd be great, but unfortunately they screwed it up years ago, when someone decided to do it by interconnecting tubes or somesuch.

  • Mike5 (unregistered) in reply to Dr. Who
    Dr. Who:
    Vollhorst:
    Remembers me of the gambling website for which I worked a while during college.

    After some hours of arguing they took my simple solution: Transfer server time, compare with local time and every second set display to local time plus the difference between the both initial times.

    And just having system synch with a Time Server, and then just using local browser system time was too easy I guess.

    So, you mean like some random web page just setting your system time to what it thinks is right? Sounds like a great idea...

  • Mike5 (unregistered) in reply to Juse
    Juse:
    > setInterval('updateClock()', 1000);

    WTF? Shouldn't this be something like: setTimeout('updateClock()', 1000); ?

    "JavaScript has a built-in setInterval function!?"
  • (cs) in reply to Anonymous
    Anonymous:
    This is ridiculous suggestion, I would never sync my local machine with a different time zone. Can you imagine the problems it would cause for scheduled tasks? All of a sudden my computer is running a defrag pass and synching remote files because the clock is twelve hours out. Not a chance, the local clock must reflect local time always.
    Think about it -- Windows by default synchronizes to time.windows.com. Now, that machine has to be in some time zone, right? Yet machines in any time zone can synchronize to that time server with no problems.

    Time synchronization between machines is not in any way affected by the time zones each machine is set to. That information is only used when presenting local times.

  • Darren (unregistered) in reply to brazzy

    Is there any OS that has come out in the last (say) 8 years that doesn't come with an NTP client, or at least an automatic rdate? I haven't set a clock since clock hardware started being built in.

    And if you're talking about an intranet, I'd think you'd have enough control over the user's machine to get one.

  • GameCrash (unregistered) in reply to Maurits
    Maurits:
    Zapp Brannigan:
    Jay:
    I think it's totally inappropriate to treat your Date like an Object.
    Should a date be treated like property?
    Like a member.

    You could always treat your Date like an Interface...

  • (cs)

    Guys, I'm scared, but there's 5 clocks on the wall, each representing different timezone, I also have a watch, two cell phones, an mp3 player and an internal phone that show time. Plus the computer. I'm just going to crawl under my desk pondering the gravity of time.

  • justsomedude (unregistered) in reply to Kiss me I'm Polish
    Dave:
    There's an abundance of evidence that the worse you treat them, the more they like it.

    Bah, that tactic only works during the hunt and early courting. Get married, wait a few years, then report back on how well that tactic works ;-)

  • (cs) in reply to Connect to Reality
    Connect to Reality:
    Next time, I'm going to skip reading the article so I can post frosttt. Also, this makes me wonder if what I'm doing with AJAX is ok.
    AJAX is a wonderful cleanser. But I prefer Windex!!
  • tation (unregistered) in reply to Code Dependent
    Code Dependent:
    What's needed is a built-in date function that hooks you up with Irish Girl.
    Yeah, 30 000 times a day.
  • Dave (unregistered) in reply to justsomedude
    justsomedude:
    Dave:
    There's an abundance of evidence that the worse you treat them, the more they like it.

    Bah, that tactic only works during the hunt and early courting. Get married, wait a few years, then report back on how well that tactic works ;-)

    You're not listening. Treating them bad includes leaving after a few months, not getting married!
  • Chris Judge (unregistered)

    Every time updateClock is called, it spawns a new interval without killing the old one.

    So at the end of the first visit, there are two intervals. One second later, both of these call updateClock and each one creates a new interval (now there are four). At the end of one second, all four call updateClock and each one creates a new interval (now there are 8). Etc.

    Here's an example that shows what happens:

    <html>
      <head>
        <title>timer test</title>
        <script type="text/javascript" language="javascript">
          var intervalCount;
          var timerCount;
    
          function initialize() {
            intervalCount = 0;
            timerCount = 0;
            startTime = Date();
    
            setInterval('updateInterval()', 1000);
    
            setTimeout('updateTimeout()', 1000);
          }
    
          function updateInterval() {
            intervalCount++;
    
            document.getElementById("txtIntervalTime").value = Date() - startTime;
            document.getElementById("txtIntervalCount").value = intervalCount;
            
            setInterval('updateInterval()', 1000);
          }
    
          function updateTimeout() {
            timerCount++;
    
            document.getElementById("txtTimeoutTime").value = Date() - startTime;
            document.getElementById("txtTimeoutCount").value = timerCount;
    
            setTimeout('updateTimeout()', 1000);
          }
        </script>
      </head>
      <body onload="initialize();">
        Elapsed time according to updateInterval(): <input id="txtIntervalTime" type="text" /> seconds.
    updateInterval has been called: <input id="txtIntervalCount" type="text" /> times.
    Elapsed time according to updateTimeout(): <input id="txtTimeoutTime" type="text" /> seconds.
    updateTimeout been called: <input id="txtTimeoutCount" type="text" /> times.
    </body> </html>

Leave a comment on “Slowing Time”

Log In or post as a guest

Replying to comment #:

« Return to Article