Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39821 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2021-04-01 06:49 -0700 |
| Last post | 2021-04-06 12:06 -0700 |
| Articles | 15 — 5 participants |
Back to article view | Back to comp.lang.javascript
setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 06:49 -0700
Re: setTimeout to a negative value? JJ <jj4public@gmail.com> - 2021-04-01 22:16 +0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 11:59 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 12:29 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 13:44 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 13:45 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-02 01:50 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-02 01:52 -0700
Re: setTimeout to a negative value? Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-01 15:59 +0000
Re: setTimeout to a negative value? Silvio <silvio@internet.com> - 2021-04-02 17:36 +0200
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-02 09:13 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-03 03:04 -0700
Re: setTimeout to a negative value? Arno Welzel <usenet@arnowelzel.de> - 2021-04-03 16:57 +0200
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-03 21:25 -0700
Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-06 12:06 -0700
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-01 06:49 -0700 |
| Subject | setTimeout to a negative value? |
| Message-ID | <c6e14063-aa94-46eb-b86f-622996c6e112n@googlegroups.com> |
Will it be handled like zero?
[toc] | [next] | [standalone]
| From | JJ <jj4public@gmail.com> |
|---|---|
| Date | 2021-04-01 22:16 +0700 |
| Message-ID | <izdznoye9yb0.vmckgo8hl0ln$.dlg@40tude.net> |
| In reply to | #39821 |
On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote: > Will it be handled like zero? Am I a moron?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-01 11:59 -0700 |
| Message-ID | <7c3bbc9d-29ae-4843-ba0f-afb5301544fan@googlegroups.com> |
| In reply to | #39824 |
torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ: > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote: > > Will it be handled like zero? > Am I a moron? I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right? timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime); passed time is the scheduled time performance -loadtime is the realtime clock We could end up with a negative timeEv "because of latency".
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-01 12:29 -0700 |
| Message-ID | <d19941f7-f92e-41fb-9add-e953a3349e9cn@googlegroups.com> |
| In reply to | #39834 |
torsdag 1 april 2021 kl. 20:59:29 UTC+2 skrev Jonas Thörnvall: > torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ: > > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote: > > > Will it be handled like zero? > > Am I a moron? > I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right? > > timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime); > > passed time is the scheduled time > performance -loadtime is the realtime clock > We could end up with a negative timeEv "because of latency". Maybe Math.abs() should be use but it could be a waste of computation power?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-01 13:44 -0700 |
| Message-ID | <170fecfe-4b8e-49eb-801a-7c4498202fcan@googlegroups.com> |
| In reply to | #39835 |
torsdag 1 april 2021 kl. 21:30:01 UTC+2 skrev Jonas Thörnvall:
> torsdag 1 april 2021 kl. 20:59:29 UTC+2 skrev Jonas Thörnvall:
> > torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ:
> > > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote:
> > > > Will it be handled like zero?
> > > Am I a moron?
> > I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right?
> >
> > timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> >
> > passed time is the scheduled time
> > performance -loadtime is the realtime clock
> > We could end up with a negative timeEv "because of latency".
> Maybe Math.abs() should be use but it could be a waste of computation power?
https://jonasth.github.io/
Anyone with good temporal and spatial abilities "logic", that can correct "my scheme to correct the note time", "check URL for realtime, animationtime and notetime"
Otherwise i think i have to make a time diagram and travel back in time.
Prove your IQ and ability :), by helping me out. Because this could potentially show up on next job interview or IQ test you do LoL
Imagine time 0 enter the function. "performanc.now()-browserLoadTIME"
function STARTPLAY(){
if (keepGoing) {
stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
//While still notes
if (playPos<copyEv.length) {
//******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT ***IN THE FUTURE
//The realtime that passed is performance.now()-browserLoadTIME
//The scheduled time is the note timings passedTime=copyEv[playPos]+passedTime;
//Realtime-scheduledtime is our latency.
//calculate latency=performance.now()-browserLoadTIME-passedTime;
//calculate new position copyEv[playPos]=copyEv[playPos]-latency;
passedTime=copyEv[playPos]+passedTime;
copyEv[playPos]=copyEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
outportarr[outportindex].send(noteMessage[playPos]);
playPos++;
if (echo && mode=="Play"){
pianoKeypressOut();
}
} else { stop();}
}
}
As a bonus i will declare the guy who solve it the next smartest guy on this NG ;)
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-01 13:45 -0700 |
| Message-ID | <c6755613-839c-4c0e-9a0c-c0437e15e7b2n@googlegroups.com> |
| In reply to | #39836 |
torsdag 1 april 2021 kl. 22:44:22 UTC+2 skrev Jonas Thörnvall:
> torsdag 1 april 2021 kl. 21:30:01 UTC+2 skrev Jonas Thörnvall:
> > torsdag 1 april 2021 kl. 20:59:29 UTC+2 skrev Jonas Thörnvall:
> > > torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ:
> > > > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > Will it be handled like zero?
> > > > Am I a moron?
> > > I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right?
> > >
> > > timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> > >
> > > passed time is the scheduled time
> > > performance -loadtime is the realtime clock
> > > We could end up with a negative timeEv "because of latency".
> > Maybe Math.abs() should be use but it could be a waste of computation power?
> https://jonasth.github.io/
> Anyone with good temporal and spatial abilities "logic", that can correct "my scheme to correct the note time", "check URL for realtime, animationtime and notetime"
> Otherwise i think i have to make a time diagram and travel back in time.
>
> Prove your IQ and ability :), by helping me out. Because this could potentially show up on next job interview or IQ test you do LoL
> Imagine time 0 enter the function. "performanc.now()-browserLoadTIME"
>
> function STARTPLAY(){
> if (keepGoing) {
> stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
> //While still notes
> if (playPos<copyEv.length) {
> //******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT ***IN THE FUTURE
> //The realtime that passed is performance.now()-browserLoadTIME
> //The scheduled time is the note timings passedTime=copyEv[playPos]+passedTime;
> //Realtime-scheduledtime is our latency.
> //calculate latency=performance.now()-browserLoadTIME-passedTime;
> //calculate new position copyEv[playPos]=copyEv[playPos]-latency;
> passedTime=copyEv[playPos]+passedTime;
> copyEv[playPos]=copyEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> outportarr[outportindex].send(noteMessage[playPos]);
> playPos++;
> if (echo && mode=="Play"){
> pianoKeypressOut();
> }
>
> } else { stop();}
> }
> }
>
> As a bonus i will declare the guy who solve it the next smartest guy on this NG ;)
If you do not solve it i will have to turn to alt.puzzels............
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-02 01:50 -0700 |
| Message-ID | <b7edfc54-a20c-453b-8ffb-7f2fcba21871n@googlegroups.com> |
| In reply to | #39836 |
torsdag 1 april 2021 kl. 22:44:22 UTC+2 skrev Jonas Thörnvall:
> torsdag 1 april 2021 kl. 21:30:01 UTC+2 skrev Jonas Thörnvall:
> > torsdag 1 april 2021 kl. 20:59:29 UTC+2 skrev Jonas Thörnvall:
> > > torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ:
> > > > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > Will it be handled like zero?
> > > > Am I a moron?
> > > I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right?
> > >
> > > timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> > >
> > > passed time is the scheduled time
> > > performance -loadtime is the realtime clock
> > > We could end up with a negative timeEv "because of latency".
> > Maybe Math.abs() should be use but it could be a waste of computation power?
> https://jonasth.github.io/
> Anyone with good temporal and spatial abilities "logic", that can correct "my scheme to correct the note time", "check URL for realtime, animationtime and notetime"
> Otherwise i think i have to make a time diagram and travel back in time.
>
> Prove your IQ and ability :), by helping me out. Because this could potentially show up on next job interview or IQ test you do LoL
> Imagine time 0 enter the function. "performanc.now()-browserLoadTIME"
>
> function STARTPLAY(){
> if (keepGoing) {
> stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
> //While still notes
> if (playPos<copyEv.length) {
> //******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT ***IN THE FUTURE
> //The realtime that passed is performance.now()-browserLoadTIME
> //The scheduled time is the note timings passedTime=copyEv[playPos]+passedTime;
> //Realtime-scheduledtime is our latency.
> //calculate latency=performance.now()-browserLoadTIME-passedTime;
> //calculate new position copyEv[playPos]=copyEv[playPos]-latency;
> passedTime=copyEv[playPos]+passedTime;
> copyEv[playPos]=copyEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> outportarr[outportindex].send(noteMessage[playPos]);
> playPos++;
> if (echo && mode=="Play"){
> pianoKeypressOut();
> }
>
> } else { stop();}
> }
> }
>
> As a bonus i will declare the guy who solve it the next smartest guy on this NG ;)
Oh i forgot please help me out, this is heavy to do without timing diagrams get my head spinning. You really want to force me use pencil and paper.....
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-02 01:52 -0700 |
| Message-ID | <b42384b7-6576-484c-b1ef-5bc7832affe2n@googlegroups.com> |
| In reply to | #39841 |
fredag 2 april 2021 kl. 10:50:14 UTC+2 skrev Jonas Thörnvall:
> torsdag 1 april 2021 kl. 22:44:22 UTC+2 skrev Jonas Thörnvall:
> > torsdag 1 april 2021 kl. 21:30:01 UTC+2 skrev Jonas Thörnvall:
> > > torsdag 1 april 2021 kl. 20:59:29 UTC+2 skrev Jonas Thörnvall:
> > > > torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ:
> > > > > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > > Will it be handled like zero?
> > > > > Am I a moron?
> > > > I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right?
> > > >
> > > > timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> > > >
> > > > passed time is the scheduled time
> > > > performance -loadtime is the realtime clock
> > > > We could end up with a negative timeEv "because of latency".
> > > Maybe Math.abs() should be use but it could be a waste of computation power?
> > https://jonasth.github.io/
> > Anyone with good temporal and spatial abilities "logic", that can correct "my scheme to correct the note time", "check URL for realtime, animationtime and notetime"
> > Otherwise i think i have to make a time diagram and travel back in time.
> >
> > Prove your IQ and ability :), by helping me out. Because this could potentially show up on next job interview or IQ test you do LoL
> > Imagine time 0 enter the function. "performanc.now()-browserLoadTIME"
> >
> > function STARTPLAY(){
> > if (keepGoing) {
> > stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
> > //While still notes
> > if (playPos<copyEv.length) {
> > //******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT ***IN THE FUTURE
> > //The realtime that passed is performance.now()-browserLoadTIME
> > //The scheduled time is the note timings passedTime=copyEv[playPos]+passedTime;
> > //Realtime-scheduledtime is our latency.
> > //calculate latency=performance.now()-browserLoadTIME-passedTime;
> > //calculate new position copyEv[playPos]=copyEv[playPos]-latency;
> > passedTime=copyEv[playPos]+passedTime;
> > copyEv[playPos]=copyEv[playPos]-(performance.now()-browserLoadTIME-passedTime);
> > outportarr[outportindex].send(noteMessage[playPos]);
> > playPos++;
> > if (echo && mode=="Play"){
> > pianoKeypressOut();
> > }
> >
> > } else { stop();}
> > }
> > }
> >
> > As a bonus i will declare the guy who solve it the next smartest guy on this NG ;)
> Oh i forgot please help me out, this is heavy to do without timing diagrams get my head spinning. You really want to force me use pencil and paper.....
https://www.youtube.com/watch?v=j1BNcSBApOU
[toc] | [prev] | [next] | [standalone]
| From | Jon Ribbens <jon+usenet@unequivocal.eu> |
|---|---|
| Date | 2021-04-01 15:59 +0000 |
| Message-ID | <slrns6bret.2fck.jon+usenet@raven.unequivocal.eu> |
| In reply to | #39821 |
On 2021-04-01, Jonas Thörnvall <jonas.thornvall@gmail.com> wrote: > Will it be handled like zero? Yes. See step 10 of: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timer-initialisation-steps but it sounds like a great way to make your code not work on random browsers that don't implement the spec exactly.
[toc] | [prev] | [next] | [standalone]
| From | Silvio <silvio@internet.com> |
|---|---|
| Date | 2021-04-02 17:36 +0200 |
| Message-ID | <606739f5$0$32573$e4fe514c@newszilla.xs4all.nl> |
| In reply to | #39821 |
On 4/1/21 3:49 PM, Jonas Thörnvall wrote: > Will it be handled like zero? > Ask Michael J Fox what happens then.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-02 09:13 -0700 |
| Message-ID | <b7abb056-f991-434a-aef3-7241c25b67f9n@googlegroups.com> |
| In reply to | #39844 |
fredag 2 april 2021 kl. 17:36:28 UTC+2 skrev Silvio: > On 4/1/21 3:49 PM, Jonas Thörnvall wrote: > > Will it be handled like zero? > > > Ask Michael J Fox what happens then. His answer is just as good as anyone elses. You think he is at alt.puzzels?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-03 03:04 -0700 |
| Message-ID | <199800fb-af5d-44d5-8c65-8269e491d600n@googlegroups.com> |
| In reply to | #39845 |
fredag 2 april 2021 kl. 18:13:22 UTC+2 skrev Jonas Thörnvall: > fredag 2 april 2021 kl. 17:36:28 UTC+2 skrev Silvio: > > On 4/1/21 3:49 PM, Jonas Thörnvall wrote: > > > Will it be handled like zero? > > > > > Ask Michael J Fox what happens then. > His answer is just as good as anyone elses. > You think he is at alt.puzzels? Honestly i would be happy if someone immediately see why it does not do what is supposed, it probably a synch thing regarding what events actually to be corrected and what event actually equal to performance now. I probably could figure out why but it is not really what i would like to do next, it is a bit annoying with things that not clear without some sort of diagram over what is going wrong.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2021-04-03 16:57 +0200 |
| Message-ID | <icre25F7vedU1@mid.individual.net> |
| In reply to | #39821 |
Jonas Thörnvall: > Will it be handled like zero? No, you will change the past - very dangerous! *scnr* -- Arno Welzel https://arnowelzel.de
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-03 21:25 -0700 |
| Message-ID | <4d3860ff-2e0e-4e43-8c03-b144d5ed721bn@googlegroups.com> |
| In reply to | #39849 |
lördag 3 april 2021 kl. 16:57:16 UTC+2 skrev Arno Welzel: > Jonas Thörnvall: > > Will it be handled like zero? > No, you will change the past - very dangerous! > > *scnr* > > > -- > Arno Welzel > https://arnowelzel.de Well i got a copy of the present, so one can always travel back :)
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-06 12:06 -0700 |
| Message-ID | <cdeef141-a523-4439-a0bb-288398952aben@googlegroups.com> |
| In reply to | #39851 |
söndag 4 april 2021 kl. 06:25:53 UTC+2 skrev Jonas Thörnvall:
> lördag 3 april 2021 kl. 16:57:16 UTC+2 skrev Arno Welzel:
> > Jonas Thörnvall:
> > > Will it be handled like zero?
> > No, you will change the past - very dangerous!
> >
> > *scnr*
> >
> >
> > --
> > Arno Welzel
> > https://arnowelzel.de
> Well i got a copy of the present, so one can always travel back :)
Did try this because it actually must be the oldPassedTime value compared to realtime, did not work it does not seem that any time at all gets subtracted from the upcoming copyEv "i am a bit confused".
I will have to make a plot compare the copyEv before after subraction to see what is going wrong.
function STARTPLAY(){
if (keepGoing) {
stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
//While still notes
if (playPos<copyEv.length) {
//******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT
//The realtime that passed is performance.now()-browserLoadTIME
//The scheduled time is the note timings passedTime=copyEv[playPos]+passedTime;
//Realtime-scheduledtime is our latency.
//calculate latency=performance.now()-browserLoadTIME-passedTime;
//calculate new position copyEv[playPos]=copyEv[playPos]-latency;
passedTime=copyEv[playPos]+passedTime;
copyEv[playPos]=copyEv[playPos]-(performance.now()-browserLoadTIME-oldPassedTime);
outportarr[outportindex].send(noteMessage[playPos]);
oldPassedTime=passedTime;
playPos++;
if (echo && mode=="Play"){
pianoKeypressOut();
}
} else { stop();}
}
}
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web