~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/times.h

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#include <drizzled/type/time.h>
 
21
 
 
22
namespace drizzled {
 
23
namespace session {
 
24
 
 
25
class DRIZZLED_API Times
 
26
{
 
27
public:
 
28
        Times() :
 
29
    _epoch(boost::gregorian::date(1970, 1 ,1))
 
30
        {
 
31
    
 
32
    _connect_time = boost::posix_time::microsec_clock::universal_time();
 
33
                utime_after_lock = 0;
 
34
        }
 
35
 
 
36
  uint64_t getConnectMicroseconds() const;
 
37
  uint64_t getConnectSeconds() const;
 
38
  void resetUserTime();
 
39
  void set_time();
 
40
  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
 
41
  void set_time_after_lock();
 
42
  void set_end_timer(Session&);
 
43
  uint64_t getElapsedTime() const;
 
44
  type::Time::epoch_t getCurrentTimestamp(bool actual= true) const;
 
45
  type::Time::epoch_t getCurrentTimestampEpoch() const;
 
46
  type::Time::epoch_t getCurrentTimestampEpoch(type::Time::usec_t& fraction_arg) const;
 
47
  type::Time::epoch_t query_start();
 
48
  boost::posix_time::ptime start_timer() const;
 
49
  boost::posix_time::ptime epoch() const;
 
50
 
 
51
  boost::posix_time::ptime _epoch;
 
52
  boost::posix_time::ptime _connect_time;
 
53
  boost::posix_time::ptime _end_timer;
 
54
  boost::posix_time::ptime _user_time;
 
55
  boost::posix_time::ptime _start_timer;
 
56
        uint64_t utime_after_lock;
 
57
};
 
58
 
 
59
}
 
60
}