~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/time/unix_timestamp.cc

  • Committer: Brian Aker
  • Date: 2010-12-19 06:20:54 UTC
  • mfrom: (2005.1.1 bug673105)
  • Revision ID: brian@tangent.org-20101219062054-1kt0l3dxs4z2z8md
Merge Dave.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "config.h"
21
21
 
22
22
#include <drizzled/function/time/unix_timestamp.h>
23
 
#include <drizzled/field/epoch.h>
 
23
#include <drizzled/field/timestamp.h>
24
24
#include <drizzled/session.h>
25
25
 
26
26
#include "drizzled/temporal.h"
30
30
 
31
31
int64_t Item_func_unix_timestamp::val_int()
32
32
{
33
 
  type::Time ltime;
 
33
  DRIZZLE_TIME ltime;
34
34
 
35
35
  assert(fixed == 1);
36
36
  if (arg_count == 0)
37
 
    return (int64_t) current_session->getCurrentTimestampEpoch();
38
 
 
 
37
    return (int64_t) current_session->query_start();
39
38
  if (args[0]->type() == FIELD_ITEM)
40
39
  {                                             // Optimize timestamp field
41
40
    Field *field=((Item_field*) args[0])->field;
42
41
    if (field->type() == DRIZZLE_TYPE_TIMESTAMP)
43
 
      return ((field::Epoch::pointer) field)->get_timestamp(&null_value);
 
42
      return ((Field_timestamp*) field)->get_timestamp(&null_value);
44
43
  }
45
44
 
46
 
  if (get_arg0_date(ltime, 0))
 
45
  if (get_arg0_date(&ltime, 0))
47
46
  {
48
47
    /*
49
48
      We have to set null_value again because get_arg0_date will also set it
76
75
  }
77
76
 
78
77
  time_t tmp;
79
 
  temporal.to_time_t(tmp);
 
78
  temporal.to_time_t(&tmp);
80
79
 
81
80
  return (int64_t) tmp;
82
81
}