From: Ry Nohryb on
Hi,

Do you think that adjusting the operating system's date/time ought to
affect a setTimeout(f, ms) or a setInterval(f, ms) ?

I don't.

I mean, when I code a setTimeout I'm saying "do this as soon as x ms
have elapsed", not do this at the time +new Date()+ x milliseconds,
right ?

But, in every browser I've tested this in (NS Navigators, iCabs, the
latest Chromes, Safaris and FireFoxes), in all of them except in Opera
(kudos to Opera !), any pending setTimeouts and setIntervals go nuts
just by adjusting the system's clock time to somewhere in the past.

Try it by yourself: open this: http://jorgechamorro.com/cljs/100/ and
see what happens to the timers as soon as you adjust the system's
clock to for example an hour less or a day less (yesterday).

Everywhere but in Opera. That's a bug, right ? Or not ? What do you
think ? Are there any (valid) excuses for that ? Or should we open a
bunch of tickets in their respective bugzillas ?

TIA,
--
Jorge.
From: Jeremy J Starcher on
On Thu, 24 Jun 2010 10:33:26 -0700, Ry Nohryb wrote:

> Hi,
>
> Do you think that adjusting the operating system's date/time ought to
> affect a setTimeout(f, ms) or a setInterval(f, ms) ?

In many other situations, adjusting the system clock leads to
unpredictable events, including possible refiring or skipping of cron
jobs and the like.

It is perfectly reasonable for software to do something unpredictable
when something totally unreasonable happens.

In other words: DON'T DO THAT.

If keeping systems in sync is important, there are ways to clocks in sync
without ever setting a system clock in backwards -- you just "slow down"
the clock until it finally catches up. While it has side effects, they
are a lot more gentle most other approaches, but this gets off topic.

By the same token, setTimeout and setInterval fail to fire when the
computer is in suspend or hibernate and UA's act differently when woken
from sleep and all UA's I've tested fail when I remove the onboard RAM.

> I don't.

I'm sorry to hear that.

> I mean, when I code a setTimeout I'm saying "do this as soon as x ms
> have elapsed", not do this at the time +new Date()+ x milliseconds,
> right ?

But what you say and what the computer understands are not the same
thing. If the OS only has one timer, how do you suggest it keeps track
of time passage besides deciding to start at:
+new Date()+ x milliseconds?


<snip>>

> Everywhere but in Opera.

It would be mildly interesting to see their implantation of that.

> That's a bug, right ? Or not ?

No.

> What do you think ?

I think if I can't say anything nice ...

> Are there any (valid) excuses for that ? Or should we open a
> bunch of tickets in their respective bugzillas ?

If I were part of the Mozilla team, I think I'd enjoy getting a bug
report on that one. Its the sort of thing I'd email around the office
for a good laugh of the day and a bit of stress relief.
From: Ry Nohryb on
On Jun 24, 8:02 pm, Jeremy J Starcher <r3...(a)yahoo.com> wrote:
> (...)
> If I were part of the Mozilla team, I think I'd enjoy getting a bug
> report on that one.  Its the sort of thing I'd email around the office
> for a good laugh of the day and a bit of stress relief.

Sure you'd do that, until you discover that the system resets the time
every now and then and suddenly your brain turns on and your idiotic
smile disappears completely:

system.log :

23/06/10 00:32:49 ntpd[13] time reset -23.5561 s
--
Jorge.
From: Ry Nohryb on
On Jun 24, 8:02 pm, Jeremy J Starcher <r3...(a)yahoo.com> wrote:
> (...) setTimeout and setInterval fail to fire when the
> computer is in suspend or hibernate and UA's act differently when woken
> from sleep and all UA's I've tested fail when I remove the onboard RAM.
> (...)

Wow! How come ?
--
Jorge.
From: Jeremy J Starcher on
On Thu, 24 Jun 2010 11:25:00 -0700, Ry Nohryb wrote:

> On Jun 24, 8:02 pm, Jeremy J Starcher <r3...(a)yahoo.com> wrote:
>> (...)
>> If I were part of the Mozilla team, I think I'd enjoy getting a bug
>> report on that one.  Its the sort of thing I'd email around the office
>> for a good laugh of the day and a bit of stress relief.
>
> Sure you'd do that, until you discover that the system resets the time
> every now and then and suddenly your brain turns on and your idiotic
> smile disappears completely:
>
> system.log :
>
> 23/06/10 00:32:49 ntpd[13] time reset -23.5561 s

I'm not an expert on ntpd, but it should only do 'hard' set the first
time it adjusts the clock, after that it should skew the system time to
sync.