~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session/times.cc

  • Committer: Olaf van der Spek
  • Date: 2011-04-08 12:15:12 UTC
  • mto: (2275.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2276.
  • Revision ID: olafvdspek@gmail.com-20110408121512-a824wng0dy94hbli
Session Times

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 */
17
17
 
18
18
#include <config.h>
19
 
#include <drizzled/session_times.h>
 
19
#include <drizzled/session/times.h>
20
20
#include <drizzled/session.h>
21
21
 
22
22
namespace drizzled {
23
23
 
 
24
type::Time::epoch_t Session::getCurrentTimestamp(bool actual) const
 
25
{
 
26
  return ((actual ? boost::posix_time::microsec_clock::universal_time() : _end_timer) - _epoch).total_microseconds();
 
27
}
 
28
 
 
29
type::Time::epoch_t Session::getCurrentTimestampEpoch() const
 
30
{
 
31
        return ((_user_time.is_not_a_date_time() ? _start_timer : _user_time) - _epoch).total_seconds();
 
32
}
 
33
 
 
34
type::Time::epoch_t Session::getCurrentTimestampEpoch(type::Time::usec_t &fraction_arg) const
 
35
{
 
36
  if (not _user_time.is_not_a_date_time())
 
37
  {
 
38
    fraction_arg= 0;
 
39
    return (_user_time - _epoch).total_seconds();
 
40
  }
 
41
 
 
42
  fraction_arg= _start_timer.time_of_day().fractional_seconds() % 1000000;
 
43
  return (_start_timer - _epoch).total_seconds();
 
44
}
 
45
 
 
46
uint64_t Session::getElapsedTime() const
 
47
{
 
48
  return (_end_timer - _start_timer).total_microseconds();
 
49
}
 
50
 
24
51
void Session::resetUserTime()
25
52
{
26
53
  _user_time= boost::posix_time::not_a_date_time;