~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/time.cc

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
  }
158
158
  else
159
159
  {
160
 
    year= (uint) (daynr*100 / 36525L);
 
160
    year= (uint32_t) (daynr*100 / 36525L);
161
161
    temp=(((year-1)/100+1)*3)/4;
162
 
    day_of_year=(uint) (daynr - (long) year * 365L) - (year-1)/4 +temp;
 
162
    day_of_year=(uint32_t) (daynr - (long) year * 365L) - (year-1)/4 +temp;
163
163
    while (day_of_year > (days_in_year= calc_days_in_year(year)))
164
164
    {
165
165
      day_of_year-=days_in_year;
177
177
    }
178
178
    *ret_month=1;
179
179
    for (month_pos= days_in_month ;
180
 
         day_of_year > (uint) *month_pos ;
 
180
         day_of_year > (uint32_t) *month_pos ;
181
181
         day_of_year-= *(month_pos++), (*ret_month)++)
182
182
      ;
183
183
    *ret_year=year;
696
696
void make_time(const DATE_TIME_FORMAT *,
697
697
               const DRIZZLE_TIME *l_time, String *str)
698
698
{
699
 
  uint32_t length= (uint) my_time_to_str(l_time, (char*) str->ptr());
 
699
  uint32_t length= (uint32_t) my_time_to_str(l_time, (char*) str->ptr());
700
700
  str->length(length);
701
701
  str->set_charset(&my_charset_bin);
702
702
}
705
705
void make_date(const DATE_TIME_FORMAT *,
706
706
               const DRIZZLE_TIME *l_time, String *str)
707
707
{
708
 
  uint32_t length= (uint) my_date_to_str(l_time, (char*) str->ptr());
 
708
  uint32_t length= (uint32_t) my_date_to_str(l_time, (char*) str->ptr());
709
709
  str->length(length);
710
710
  str->set_charset(&my_charset_bin);
711
711
}
714
714
void make_datetime(const DATE_TIME_FORMAT *,
715
715
                   const DRIZZLE_TIME *l_time, String *str)
716
716
{
717
 
  uint32_t length= (uint) my_datetime_to_str(l_time, (char*) str->ptr());
 
717
  uint32_t length= (uint32_t) my_datetime_to_str(l_time, (char*) str->ptr());
718
718
  str->length(length);
719
719
  str->set_charset(&my_charset_bin);
720
720
}
812
812
      days--;
813
813
      sec+= 3600*24L;
814
814
    }
815
 
    ltime->second_part= (uint) microseconds;
816
 
    ltime->second= (uint) (sec % 60);
817
 
    ltime->minute= (uint) (sec/60 % 60);
818
 
    ltime->hour=   (uint) (sec/3600);
 
815
    ltime->second_part= (uint32_t) microseconds;
 
816
    ltime->second= (uint32_t) (sec % 60);
 
817
    ltime->minute= (uint32_t) (sec/60 % 60);
 
818
    ltime->hour=   (uint32_t) (sec/3600);
819
819
    daynr= calc_daynr(ltime->year,ltime->month,1) + days;
820
820
    /* Day number from year 0 to 9999-12-31 */
821
821
    if ((uint64_t) daynr > MAX_DAY_NUMBER)
848
848
             ltime->month-1 + sign * (long) interval.month);
849
849
    if (period >= 120000L)
850
850
      goto invalid_date;
851
 
    ltime->year= (uint) (period / 12);
852
 
    ltime->month= (uint) (period % 12L)+1;
 
851
    ltime->year= (uint32_t) (period / 12);
 
852
    ltime->month= (uint32_t) (period % 12L)+1;
853
853
    /* Adjust day if the new month doesn't have enough days */
854
854
    if (ltime->day > days_in_month[ltime->month-1])
855
855
    {
917
917
    days= (long)l_time1->day - l_sign * (long)l_time2->day;
918
918
  else
919
919
  {
920
 
    days= calc_daynr((uint) l_time1->year,
921
 
                     (uint) l_time1->month,
922
 
                     (uint) l_time1->day);
 
920
    days= calc_daynr((uint32_t) l_time1->year,
 
921
                     (uint32_t) l_time1->month,
 
922
                     (uint32_t) l_time1->day);
923
923
    if (l_time2->time_type == DRIZZLE_TIMESTAMP_TIME)
924
924
      days-= l_sign * (long)l_time2->day;
925
925
    else
926
 
      days-= l_sign*calc_daynr((uint) l_time2->year,
927
 
                               (uint) l_time2->month,
928
 
                               (uint) l_time2->day);
 
926
      days-= l_sign*calc_daynr((uint32_t) l_time2->year,
 
927
                               (uint32_t) l_time2->month,
 
928
                               (uint32_t) l_time2->day);
929
929
  }
930
930
 
931
931
  microseconds= ((int64_t)days*86400L +