date - Java - condition statement based on milliseconds -


quick question here, need execute method after specific time period has passed (in milliseconds):

static double incrtruebinaryerr = 62.5; static double incrtruebinarymov = 31.25; static double incr01001 = 360000; static double incr_1101 = 125; static double incr05008 = 3600000; static double incr10004 = 1024000; static double incr22000 = 1000; static double incr22001 = 1000;  date currdate;      while (true)     {     currdate = new date();      if (currdate.gettime() == currdate.gettime() + incrtruebinaryerr)         //do stuff      if (currdate.gettime() == currdate.gettime() + incrtruebinarymov)         //do stuff      if (currdate.gettime() == currdate.gettime() + incr01001)         //do stuff      if (currdate.gettime() == currdate.gettime() + incr_1101)         //do stuff      if (currdate.gettime() == currdate.gettime() + incr05008)         //do stuff      if (currdate.gettime() == currdate.gettime() + incr10004)         //do stuff      if (currdate.gettime() == currdate.gettime() + incr22000)         //do stuff      if (currdate.gettime() == currdate.gettime() + incr22001)         //do stuff      } 

however, program never hits of these because of how specific time intervals are.

what best way go doing this?

this kind of expression currdate.gettime() == currdate.gettime() + incr01001 evaluate true if incr01001 == 0. same reason x == x + y when y == 0.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -