• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Refresh Timing at specific times

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got a dashboard system that creates various production reports for my company. Right now it refreshes in 5 minute increments (using javascript), starting at the time the system is accessed. This obviously means that two people looking at the same screen can be viewing data that's up to 5 minutes off from one another.

In an effort to make it more of an "Apples to Apples" situation, I'd like to get the time that the user signs on, calculate the difference between that and the next "5" of the hour, have it refresh at that time then every 5 after. (So, if the user signs on at 9:31:30 it'll calculate the difference between then and 9:35, refresh at 9:35, then start refreshing every 5 minutes after that.) Also, I'd need to be able to call this on a "manual refresh" situation, where the user hits a refresh button. The system should only automatically refresh at 0, 5, 10, 15, ... 55 minute marks.

So far I'm not having much luck figuring out how to do the calculation.

Does anyone have any suggestions as to how to go about this?

Thanks!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Grab the date object and calculate the time difference and use that time to set the setTimeout.

FYI, computer clocks are not the same so they will be off. Your system is going to be hammered all at once if you have a bunch of users using the system.

Eric
 
Terri Layman
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Pascarello wrote:Grab the date object and calculate the time difference and use that time to set the setTimeout.

FYI, computer clocks are not the same so they will be off. Your system is going to be hammered all at once if you have a bunch of users using the system.

Eric



Thanks. I'll look into it. I think I was trying to use a variation on it before and having some issues, so hopefully it'll work better this time.

And I know the clocks may not be entirely the same, but this is an effort to get the refreshing of the data more "in sych". And I don't think our system is going to be too taxed. It's entirely an internal system, and only about 25 people in the whole of the company have access to it.

Thanks again....
 
I like tacos! And this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic