On Monday, June 27, 2016 at 3:22:28 PM UTC+7, D David wrote:
> So you really think we should recode the time-checking logic on all
> clients? Isn't that simpler to implement only at the server-level?
 
Not really. Here's the entire code in our system for determining if the
vacation is active:
 
var vacationIsActive = function ( vacation ) {
var now = Date.now();
var fromDate = vacation.fromDate;
var toDate = vacation.toDate;
return vacation.isEnabled &&
( !fromDate || fromDate <= now ) &&
( !toDate || toDate > now );
}
 
On Mon, 27 Jun 2016, at 06:26 PM, Benoit Tellier wrote:
> Moreover, Isn't keeping time up to date across sever and client also
> difficult in a distributed system, as it may also become out of sync ?
> Isn't it just moving the problem ?
 
Huh? You don't have to do anything. The OS is in charge of making sure
its time is correct, and they do a pretty good job of that these day;
all modern systems synchronise their time via NTP or similar. If you're
really concerned you could add an API to request the "server" time and
then cache the difference if the local time is skewed, but honestly we
use this system in production and I've never seen a support ticket from
anyone running into a problem due to out-of-sync local time.
 
Neil.

-- 
You received this message because you are subscribed to the Google Groups 
"JMAP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jmap-discuss/1467016551.2198867.649382185.6EFC8FE0%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to