~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/type/time.h

  • Committer: Brian Aker
  • Date: 2011-01-22 07:20:17 UTC
  • mfrom: (2098.3.4 timestamp)
  • Revision ID: brian@tangent.org-20110122072017-1y8v3z1z3v9ml6tb
MergeĀ inĀ timestamp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
/*
93
93
  datatime_t while being stored in an integer is actually a formatted value.
94
94
*/
95
 
struct datatime_t {
96
 
  int64_t value;
97
 
};
98
 
 
99
 
 
 
95
typedef int64_t datetime_t;
 
96
 
 
97
inline bool is_valid(const datetime_t &value)
 
98
{
 
99
  if (value == -1L)
 
100
    return false;
 
101
 
 
102
  return true;
 
103
}
100
104
 
101
105
class Time
102
106
{
169
173
 
170
174
  void convert(drizzled::String &str, timestamp_t arg= type::DRIZZLE_TIMESTAMP_DATETIME);
171
175
  void convert(char *str, size_t &to_length, timestamp_t arg= type::DRIZZLE_TIMESTAMP_DATETIME);
172
 
  void convert(uint64_t &datetime, timestamp_t arg= type::DRIZZLE_TIMESTAMP_DATETIME);
 
176
  void convert(datetime_t &datetime, timestamp_t arg= type::DRIZZLE_TIMESTAMP_DATETIME);
 
177
  void convert(datetime_t &ret, int64_t nr, uint32_t flags, int *was_cut);
173
178
 
174
179
  void store(const type::Time::epoch_t &from, bool use_localtime= false);
175
180
  void store(const type::Time::epoch_t &from, const usec_t &from_fractional_seconds, bool use_localtime= false);
178
183
 
179
184
  static const uint32_t FRACTIONAL_DIGITS= 1000000;
180
185
  static const size_t MAX_STRING_LENGTH= 32;   // +32 to make my_snprintf_{8bit|ucs2} happy
 
186
 
 
187
  bool check(bool not_zero_date, uint32_t flags, int *was_cut) const;
181
188
};
182
189
 
183
190
}
184
191
 
185
 
bool check_date(const type::Time *ltime, bool not_zero_date,
186
 
                   uint32_t flags, int *was_cut);
187
192
 
188
193
type::timestamp_t str_to_datetime(const char *str, uint32_t length, type::Time *l_time, uint32_t flags, int *was_cut);
189
194
 
190
 
int64_t number_to_datetime(int64_t nr, type::Time *time_res,
191
 
                            uint32_t flags, int *was_cut);
192
 
uint64_t TIME_to_uint64_t_datetime(const type::Time *);
193
 
uint64_t TIME_to_uint64_t(const type::Time *);
194
 
 
195
 
 
196
195
bool str_to_time(const char *str,uint32_t length, type::Time *l_time, int *warning);
197
196
 
198
197
long calc_daynr(uint32_t year,uint32_t month,uint32_t day);