~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/epoch.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
#include <boost/lexical_cast.hpp>
23
23
#include <drizzled/field/epoch.h>
24
24
#include <drizzled/error.h>
 
25
#include <drizzled/tztime.h>
25
26
#include <drizzled/table.h>
26
27
#include <drizzled/session.h>
27
 
#include <drizzled/session/times.h>
28
 
#include <drizzled/current_session.h>
29
 
#include <drizzled/temporal.h>
30
 
#include <cmath>
 
28
 
 
29
#include <math.h>
 
30
 
31
31
#include <sstream>
32
32
 
33
 
namespace drizzled {
34
 
namespace field {
 
33
#include "drizzled/temporal.h"
 
34
 
 
35
namespace drizzled
 
36
{
 
37
 
 
38
namespace field
 
39
{
35
40
 
36
41
/**
37
42
  TIMESTAMP type holds datetime values in range from 1970-01-01 00:00:01 UTC to
149
154
 
150
155
int Epoch::store(const char *from,
151
156
                 uint32_t len,
152
 
                 const charset_info_st * const )
 
157
                 const CHARSET_INFO * const )
153
158
{
154
159
  Timestamp temporal;
155
160
 
229
234
  return 0;
230
235
}
231
236
 
232
 
double Epoch::val_real(void) const
 
237
double Epoch::val_real(void)
233
238
{
234
239
  return (double) Epoch::val_int();
235
240
}
236
241
 
237
 
int64_t Epoch::val_int(void) const
 
242
int64_t Epoch::val_int(void)
238
243
{
239
244
  uint64_t temp;
240
245
 
251
256
  return result;
252
257
}
253
258
 
254
 
String *Epoch::val_str(String *val_buffer, String *) const
 
259
String *Epoch::val_str(String *val_buffer, String *)
255
260
{
256
261
  uint64_t temp= 0;
257
262
  char *to;
275
280
  return val_buffer;
276
281
}
277
282
 
278
 
bool Epoch::get_date(type::Time &ltime, uint32_t) const
 
283
bool Epoch::get_date(type::Time &ltime, uint32_t)
279
284
{
280
285
  uint64_t temp;
281
286
  type::Time::epoch_t time_temp;
290
295
  return 0;
291
296
}
292
297
 
293
 
bool Epoch::get_time(type::Time &ltime) const
 
298
bool Epoch::get_time(type::Time &ltime)
294
299
{
295
300
  return Epoch::get_date(ltime, 0);
296
301
}
342
347
void Epoch::set_time()
343
348
{
344
349
  Session *session= getTable() ? getTable()->in_use : current_session;
345
 
  time_t tmp= session->times.getCurrentTimestampEpoch();
 
350
  time_t tmp= session->getCurrentTimestampEpoch();
346
351
 
347
352
  set_notnull();
348
353
  pack_num(static_cast<uint32_t>(tmp));
361
366
  }
362
367
}
363
368
 
364
 
long Epoch::get_timestamp(bool *null_value) const
 
369
long Epoch::get_timestamp(bool *null_value)
365
370
{
366
371
  if ((*null_value= is_null()))
367
372
    return 0;