Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
setTimeout behaving weirdly in Firefox

The objective is to delay execute a function after 1000/2000 ms. Even when delay=0 actual delay introduced is around 1000ms

In the below code when mm==0 and ss==19, the second console.log is printing after around 1000ms. When I set delay=1000 it prints after around 2000 seconds. Any idea what could be wrong?

It's on Firefox 56 version. This version offers some exceptional convenience which isn't there in latest versions.

Simplified Code

var d = new Date();
var mm = d.getMinutes();
var ss = d.getSeconds();
var  delay = 0;
if (mm == 0 && ss <= 20)
    {
       
        console.log("Current time1=" + new Date().getTime())
    }

var fun = function ()
    {
        console.log("Current time2=" + new Date().getTime())
       
      
    }

setTimeout(fun, delay);

Actual Code

var d = new Date();
var mm = d.getMinutes();
var ss = d.getSeconds();
var delay = 0;

if (mm == 0 && ss <= 20)
    {
        delay =
                gg_user_selections.bid_details.login_delay_offset_20;
        console.log("Extra delay introdu:" + delay);
    }

var fun9 = function ()
    {
        if (mm == 0 && ss <= 20)
            {
                console.log("Extra delay introdu1:" + delay);
            }
        ff_do_embed_code(
                function ()
                    {
                        $("#btnLogin").click();
                    }
        );
        gg_last_login_click_time = new Date().getTime();

        $(".modalPop").show();
    }

setTimeout(fun9, delay);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!