I need to create a process that maintains a separate date. The data will be retrieved from a server and maintain a time from the current date, time, and now functions. I am sure that I need to create a separate thread with a timer that maintains seconds since a given point in time. Can anybody suggest a good point to get started with this process.

Comments

  1. I wouldn't think that you need to reinvent the wheel...or clock. When you grab the starting time from the server also grab a "delta" from the local machine. Now when you need to know the "current" time, subtract the delta from "now" and add the difference to the server time. I don't know how precise you need to be, so that will determine how you grab your delta and now.

    ReplyDelete
  2. Christian Peta and Sean Boone. Both of you are in the ballpark. The server will serve as a central point for time and information distribution. Each user is assigned a timezone. When certain dates and times are loaded their clocks will be adjusted to reflect this time based on the server and this adjustment factor. I can't rely on the users PC time as it might be incorrect or it could be adjusted to back date entries. I suspect after a certain period of time I would go back to the server to resynch date and time clock values and maintain this independent clock.

    ReplyDelete
  3. I once wrote a prototype app for a choreographer were users would have their phones connected and receive instructions on moving around. "Perfect" syncing over different networks was never implemented but i did write a experience paper on how more accurate syncing could be done. This was before websockets, but i think an elaborate syncing process would be needed anyway. The better the start sync, the smaller the stage she would be able to use. Point being that the solution would be similar. Polling, calculating deltas until at some point the server/controller would be happy with the precision of the client clocks at that time the "start dance" button would turn green. A startup stole the paper but I'm not sad, the project never became anything anyway.

    ReplyDelete

Post a Comment