~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/tztime.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
typedef struct ttinfo
25
25
{
26
26
  long tt_gmtoff; // Offset from UTC in seconds
27
 
  uint tt_isdst;   // Is daylight saving time or not. Used to set tm_isdst
28
 
  uint tt_abbrind; // Index of start of abbreviation for this time type.
 
27
  uint32_t tt_isdst;   // Is daylight saving time or not. Used to set tm_isdst
 
28
  uint32_t tt_abbrind; // Index of start of abbreviation for this time type.
29
29
  /*
30
30
    We don't use tt_ttisstd and tt_ttisgmt members of original elsie-code
31
31
    struct since we don't support POSIX-style TZ descriptions in variables.
47
47
typedef struct revtinfo
48
48
{
49
49
  long rt_offset; // Offset of local time from UTC in seconds
50
 
  uint rt_type;    // Type of period 0 - Normal period. 1 - Spring time-gap
 
50
  uint32_t rt_type;    // Type of period 0 - Normal period. 1 - Spring time-gap
51
51
} REVT_INFO;
52
52
 
53
53
#ifdef TZNAME_MAX
63
63
*/
64
64
typedef struct st_time_zone_info
65
65
{
66
 
  uint leapcnt;  // Number of leap-second corrections
67
 
  uint timecnt;  // Number of transitions between time types
68
 
  uint typecnt;  // Number of local time types
69
 
  uint charcnt;  // Number of characters used for abbreviations
70
 
  uint revcnt;   // Number of transition descr. for TIME->my_time_t conversion
 
66
  uint32_t leapcnt;  // Number of leap-second corrections
 
67
  uint32_t timecnt;  // Number of transitions between time types
 
68
  uint32_t typecnt;  // Number of local time types
 
69
  uint32_t charcnt;  // Number of characters used for abbreviations
 
70
  uint32_t revcnt;   // Number of transition descr. for TIME->my_time_t conversion
71
71
  /* The following are dynamical arrays are allocated in MEM_ROOT */
72
72
  my_time_t *ats;       // Times of transitions between time types
73
73
  unsigned char *types; // Local time types for transitions
97
97
 
98
98
#if !defined(TZINFO2SQL)
99
99
 
100
 
static const uint mon_lengths[2][MONS_PER_YEAR]=
 
100
static const uint32_t mon_lengths[2][MONS_PER_YEAR]=
101
101
{
102
102
  { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
103
103
  { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
104
104
};
105
105
 
106
 
static const uint mon_starts[2][MONS_PER_YEAR]=
 
106
static const uint32_t mon_starts[2][MONS_PER_YEAR]=
107
107
{
108
108
  { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
109
109
  { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
110
110
};
111
111
 
112
 
static const uint year_lengths[2]=
 
112
static const uint32_t year_lengths[2]=
113
113
{
114
114
  DAYS_PER_NYEAR, DAYS_PER_LYEAR
115
115
};
141
141
  long rem;
142
142
  int y;
143
143
  int yleap;
144
 
  const uint *ip;
 
144
  const uint32_t *ip;
145
145
 
146
146
  days= (long) (t / SECS_PER_DAY);
147
147
  rem=  (long) (t % SECS_PER_DAY);
220
220
*/
221
221
static uint
222
222
find_time_range(my_time_t t, const my_time_t *range_boundaries,
223
 
                uint higher_bound)
 
223
                uint32_t higher_bound)
224
224
{
225
 
  uint i, lower_bound= 0;
 
225
  uint32_t i, lower_bound= 0;
226
226
 
227
227
  /*
228
228
    Function will work without this assertion but result would be meaningless.
481
481
                bool *in_dst_time_gap)
482
482
{
483
483
  my_time_t local_t;
484
 
  uint saved_seconds;
485
 
  uint i;
 
484
  uint32_t saved_seconds;
 
485
  uint32_t i;
486
486
  int shift= 0;
487
487
 
488
488
  if (!validate_timestamp_range(t))
907
907
Time_zone_offset::Time_zone_offset(long tz_offset_arg):
908
908
  offset(tz_offset_arg)
909
909
{
910
 
  uint hours= abs((int)(offset / SECS_PER_HOUR));
911
 
  uint minutes= abs((int)(offset % SECS_PER_HOUR / SECS_PER_MIN));
 
910
  uint32_t hours= abs((int)(offset / SECS_PER_HOUR));
 
911
  uint32_t minutes= abs((int)(offset % SECS_PER_HOUR / SECS_PER_MIN));
912
912
  ulong length= snprintf(name_buff, sizeof(name_buff), "%s%02d:%02d",
913
913
                         (offset>=0) ? "+" : "-", hours, minutes);
914
914
  name.set(name_buff, length, &my_charset_utf8_general_ci);
1098
1098
    1 - String doesn't contain valid time zone offset
1099
1099
*/
1100
1100
bool
1101
 
str_to_offset(const char *str, uint length, long *offset)
 
1101
str_to_offset(const char *str, uint32_t length, long *offset)
1102
1102
{
1103
1103
  const char *end= str + length;
1104
1104
  bool negative;