I'm building a platform where precise time sync is critical (+/- 0.01 sec). Based on my (admittedly limited) understanding of AWS, it looks like clock drift between multiple server instances could become a real problem. However, I've been told RDS will not suffer from clock drift even as it scales up. As a result, I'm planning to use RDS when we go live and am trying to always pull now() with a database query instead of just using Carbon::now() (which would pull time from the Apache server). So I guess the preliminary question is: have I missed anything? Is that going to work? Is there a better approach that I've ignored?
Assuming my approach is correct, I'm trying to clean up the following:
$currentTime = DB::select(DB::raw('SELECT NOW()'));
First off, that just looks messy and I'm sure there's a cleaner way. Second, instead of giving me the timestamp, it's returning an array that looks like this:
Array
(
[0] => stdClass Object
(
[NOW()] => 2016-05-04 14:03:49
)
)
I tried using ->first() and ->get(), but neither worked (both produce errors). How should I be handling this?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rpRrjT
via IFTTT
Aucun commentaire:
Enregistrer un commentaire