0

I am building a web app using this calendar.
Jquery Based Full Calendar This calendar is based on jquery and jquery is client side code so it works on client side time.I want this calendar to use my php server time for its whole working. So which would be the best method for this.

  1. Should i get server time every time once this calendar gets loaded and keep it counting using that time .
  2. Or should i sync it with server at every 57sec and get server time.
Kaushil Rambhia
  • 195
  • 2
  • 6
  • 19
  • 1
    is there clock functionality? if you're just using the calendar can you just fetch the current date on page load? – dm03514 Nov 27 '12 at 18:59
  • 1
    yaa dude its completely based on clock..as it uses clock time for adding an event in calendar. – Kaushil Rambhia Nov 27 '12 at 19:01
  • 1
    are all of your users in same time zone? if not how do you know what time is it at their end? if users are registered on you website I would add something like timezone. I am teling you this so you can check if **javascript user clock** is ok with user timezone in database. If this is false you can alert user please fix your clock. I would use user clock and not the server time if this is the case. – pregmatch Nov 27 '12 at 19:40
  • and if your users are in same time zone then i would sync with server time (number 2 in your question). – pregmatch Nov 27 '12 at 19:41
  • @pregmatch i agree with your thought..i am also thinking to notify user each time he login and match his time with server. – Kaushil Rambhia Nov 27 '12 at 19:54
  • But is there some other way to sync time?? – Kaushil Rambhia Nov 27 '12 at 19:55
  • If this is a case (user has time zones), dont since anything just make calendar base on user clock and check user selection after he picks some time/date. – pregmatch Nov 27 '12 at 20:04

2 Answers2

0

Make your users select a time zone and calculate their time with UTC time you get from your server. Most of the websites use this system as I know.

Taha Paksu
  • 15,371
  • 2
  • 44
  • 78
0

You should take a look at this question - it should have a lot of useful information for you in regards to your question about syncing time.

That said, think about how your application scales and work from there. A request per minute can easily add up to a load that isn't easy to handle.

Do you really need real-time syncing of time events if you're just going to have people schedule events at a future period of time/date? If this is for a calendar, you really just need to make sure that the client's time matches your at the hour and minute level, and that the dates are the same. After that, you can rely on the client's time, unless you're scheduling by the second. (Then again, I don't know what this calendar is for...)

Additionally, if you're saving their events server side, I'm not sure that it would do you any good to sync time in the way you're considering. If you're looking to push updates to all calendars at once when someone makes a change, you might look into alternative ways to do that.

Good luck - I hope this helps.

Community
  • 1
  • 1