summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-02-23 08:50:51 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-02-23 09:15:13 +0000
commitca52a40817ad7cecb36551dab9c7d5013162748a (patch)
treec9c8833b59caf0a2e4d3482deb72426730167dad /index.php
parent3e0eba269bca585f7d56f2be0f87364fa134cc42 (diff)
downloadwebtrees-ca52a40817ad7cecb36551dab9c7d5013162748a.tar.gz
webtrees-ca52a40817ad7cecb36551dab9c7d5013162748a.tar.bz2
webtrees-ca52a40817ad7cecb36551dab9c7d5013162748a.zip
Use UTC internally, and convert to local time for display
Diffstat (limited to 'index.php')
-rw-r--r--index.php20
1 files changed, 2 insertions, 18 deletions
diff --git a/index.php b/index.php
index fc44be72a0..84545ece73 100644
--- a/index.php
+++ b/index.php
@@ -163,24 +163,8 @@ if ($max_execution_time !== '' && strpos(ini_get('disable_functions'), 'set_time
// Sessions
Session::start();
-// Note that the database/webservers may not be synchronised, so use DB time throughout.
-define('WT_TIMESTAMP', Carbon::now()->timestamp);
-
-// Users get their own time-zone. Visitors get the site time-zone.
-try {
- if (Auth::check()) {
- date_default_timezone_set(Auth::user()->getPreference('TIMEZONE'));
- } else {
- date_default_timezone_set(Site::getPreference('TIMEZONE'));
- }
-} catch (ErrorException $exception) {
- // Server upgrades and migrations can leave us with invalid timezone settings.
- date_default_timezone_set('UTC');
-}
-
-define('WT_TIMESTAMP_OFFSET', (new DateTime('now'))->getOffset());
-
-define('WT_CLIENT_JD', 2440588 + intdiv(WT_TIMESTAMP + WT_TIMESTAMP_OFFSET, 86400));
+define('WT_TIMESTAMP', Carbon::now('UTC')->timestamp);
+define('WT_CLIENT_JD', 2440588 + intdiv(WT_TIMESTAMP, 86400));
// Update the last-login time no more than once a minute
if (WT_TIMESTAMP - Session::get('activity_time') >= 60) {