public function testHandleOffset() { $gmt_today = $this->time_date->nowDb(); $date1 = $this->time_date->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format()); $date2 = $this->time_date->nowDb(); $this->assertEquals($date1, $date2, "HandleOffset should be equaivalent to nowDb"); }
/** * test getting DB date formats indifferent ways */ public function testGetDB() { $this->assertEquals(gmdate($this->time_date->merge_date_time($this->time_date->get_db_date_format(), $this->time_date->get_db_time_format())), $this->time_date->nowDb()); }
/** * Tracks slow queries in the tracker database table * * @param string $query value of query to track */ protected function track_slow_queries($query) { $trackerManager = TrackerManager::getInstance(); if ($trackerManager->isPaused()) { return; } if ($monitor = $trackerManager->getMonitor('tracker_queries')) { $monitor->setValue('date_modified', $this->timedate->nowDb()); $monitor->setValue('text', $query); $monitor->setValue('sec_total', $this->query_time); //Save the monitor to cache (do not flush) $trackerManager->saveMonitor($monitor, false); } }
/** * handles some date/time foramtting * @param string time Time (usually "now") * @param object user User, usually admin (id = '1') * @param boolean to_local, convert to user's time format * @return string formatted time. */ function handleDateFormat($time, $user = null, $to_local = true) { global $timedate; if (!isset($timedate) || empty($timedate)) { $timedate = new TimeDate(); } // get proper user $user = empty($user) ? $this->user : $user; $dbTime = $timedate->nowDb(); if ($to_local) { $ret = $timedate->to_display_date_time($dbTime, true, true, $user); return $ret; } return $dbTime; }