drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
times.h
1/* Drizzle
2 * Copyright (C) 2011 Olaf van der Spek
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <boost/date_time.hpp>
19#include <drizzled/common_fwd.h>
20
21namespace drizzled {
22namespace session {
23
24class DRIZZLED_API Times
25{
26public:
27 Times() :
28 _epoch(boost::gregorian::date(1970, 1 ,1))
29 {
30 _connect_time = boost::posix_time::microsec_clock::universal_time();
31 utime_after_lock = 0;
32 }
33
34 uint64_t getConnectMicroseconds() const;
35 uint64_t getConnectSeconds() const;
36 void resetUserTime();
37 void set_time();
38 void set_time(time_t); // This is done by a sys_var, as long as user_time is set, we will use that for all references to time
39 void set_time_after_lock();
40 void set_end_timer(Session&);
41 uint64_t getElapsedTime() const;
42 type::epoch_t getCurrentTimestamp(bool actual= true) const;
43 type::epoch_t getCurrentTimestampEpoch() const;
44 type::epoch_t getCurrentTimestampEpoch(type::usec_t& fraction_arg) const;
45 type::epoch_t query_start();
46 boost::posix_time::ptime start_timer() const;
47 boost::posix_time::ptime epoch() const;
48
49 boost::posix_time::ptime _epoch;
50 boost::posix_time::ptime _connect_time;
51 boost::posix_time::ptime _end_timer;
52 boost::posix_time::ptime _user_time;
53 boost::posix_time::ptime _start_timer;
54 uint64_t utime_after_lock;
55};
56
57}
58}
TODO: Rename this file - func.h is stupid.
#define DRIZZLED_API
Definition visibility.h:38