~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.h

  • Committer: Patrick Crews
  • Date: 2010-09-14 20:21:03 UTC
  • mto: (1771.1.1 pcrews)
  • mto: This revision was merged to the branch mainline in revision 1772.
  • Revision ID: gleebix@gmail.com-20100914202103-1db2n0bshzafep19
Moved transaction_log tests into updated non-publisher-based tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
#ifndef DRIZZLED_TZTIME_H
22
22
#define DRIZZLED_TZTIME_H
23
23
 
 
24
#if TIME_WITH_SYS_TIME
 
25
# include <sys/time.h>
 
26
# include <time.h>
 
27
#else
 
28
# if HAVE_SYS_TIME_H
 
29
#  include <sys/time.h>
 
30
# else
 
31
#  include <time.h>
 
32
# endif
 
33
#endif
 
34
 
24
35
#include "drizzled/memory/sql_alloc.h"
25
36
 
26
 
#include "drizzled/type/time.h"
27
 
 
28
37
namespace drizzled
29
38
{
30
39
 
31
40
class String;
32
 
 
33
 
namespace type {
34
 
class Time;
35
 
}
 
41
typedef struct st_drizzle_time DRIZZLE_TIME;
36
42
 
37
43
/**
38
44
  This class represents abstract time zone and provides
39
 
  basic interface for type::Time <-> type::Time::epoch_t conversion.
 
45
  basic interface for DRIZZLE_TIME <-> time_t conversion.
40
46
  Actual time zones which are specified by DB, or via offset
41
47
  or use system functions are its descendants.
42
48
*/
45
51
public:
46
52
  Time_zone() {}                              /* Remove gcc warning */
47
53
  /**
48
 
    Converts local time in broken down type::Time representation to
49
 
    type::Time::epoch_t (UTC seconds since Epoch) represenation.
 
54
    Converts local time in broken down DRIZZLE_TIME representation to
 
55
    time_t (UTC seconds since Epoch) represenation.
50
56
    Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
51
57
    falls into spring time-gap (or lefts it untouched otherwise).
52
58
  */
53
 
  virtual type::Time::epoch_t TIME_to_gmt_sec(const type::Time &t,
54
 
                                              bool *in_dst_time_gap) const = 0;
 
59
  virtual time_t TIME_to_gmt_sec(const DRIZZLE_TIME *t,
 
60
                                 bool *in_dst_time_gap) const = 0;
55
61
  /**
56
 
    Converts time in type::Time::epoch_t representation to local time in
57
 
    broken down type::Time representation.
 
62
    Converts time in time_t representation to local time in
 
63
    broken down DRIZZLE_TIME representation.
58
64
  */
59
 
  virtual void gmt_sec_to_TIME(type::Time &tmp, type::Time::epoch_t t) const = 0;
60
 
 
 
65
  virtual void   gmt_sec_to_TIME(DRIZZLE_TIME *tmp, time_t t) const = 0;
61
66
  /**
62
67
    Because of constness of String returned by get_name() time zone name
63
68
    have to be already zeroended to be able to use String::ptr() instead