|
Bummer, dude. Take a break
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
1) Press F12 (while viewing this page)
2) copy the code below
3) paste it into the console and run it
let startTime = Date.now();
setTimeout(()=>{
let endTime= Date.now();
let timeSpent=(endTime-startTime)/1000+" seconds.";
alert("It took " + timeSpent + " to complete");
},Math.floor((Math.random() * 8000)));
It'll set a timeout that will last between 0 and 8 seconds.
When the timeout fires, it will calc times between startTime and endTime (in seconds) and display the value in an alert.
Does calculating the time between those two times not work?
It's an interesting coincidence because I just used the time measuring code in some JS I wrote yesterday.
There is also the new(er)
window.performance.now()
Update
Just noticed that it sounds like you are saying you "have a start and end time"...maybe as a string. that's a lot more difficult.
|
|
|
|
|
I think the "problem" with my code is that the value comes from an input field.
Your code seems to work, but I don't think I'll notice a time zone difference in seconds
|
|
|
|
|
Sander Rossel wrote: but I don't think I'll notice a time zone difference in seconds
Yeah, I was thinking that too, but I just wanted to provide some code that would show a difference in two times. Good luck with it.
|
|
|
|
|
I feel your pain. I avoid front end web work like the plague.
Real programmers use butterflies
|
|
|
|
|
That means a lot coming from someone who writes parsers, lexers and MIDI libraries!
|
|
|
|
|
And not a one with any javascript code in it!
Real programmers use butterflies
|
|
|
|
|
Sander Rossel wrote: The reason I'm so pissed is because it took me until 01:30 to fix this, went to bed all worked up and didn't sleep until 04:30
So is that 3 hours til you got to sleep? Or 4? Or 2? What does Javascript say?
|
|
|
|
|
JavaScript says "sweet dreams" before smothering me with a pillow.
|
|
|
|
|
|
|
What puns are part of - a sentence full of actors! (8)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
a sentence is full of WORDs
a PLAY is full of actors
WORDPLAY - puns a part of
// TODO: Insert something here
|
|
|
|
|
Close enough!
You are up tomorrow.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I was thinking along the same line exactly - why it is 'only' close?
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Because punctuation is (nearly always) only there to confuse:
What puns are
part of - a sentence WORD
full of actors! PLAY
WORDPLAY
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Tesla-tequila
Cheers!
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
Musk has such a fan base that he would even sell portable flame-throwers or ugly angular cars if he produced any.
Wait a second...
|
|
|
|
|
Musk could probably sell "The Homer[^]".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Stop feeding him with bad ideas, because you know what Elon does with bad ideas : he makes them happen.
|
|
|
|
|
Un caballito? Arriba!
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
Why 21?!
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Rocket fuel.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Quote: Pfizer's vaccine needs to be stored at about minus 75 degrees Celsius, which is about 50 degrees colder than any vaccine currently used in the United States.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|