~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/tztime.cc

  • Committer: Brian Aker
  • Date: 2008-07-11 00:33:12 UTC
  • mfrom: (51.1.83 remove-dbug)
  • Revision ID: brian@tangent.org-20080711003312-f4sf5n2z3obor1u8
Comming Jay's merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
  /*
232
232
    Function will work without this assertion but result would be meaningless.
233
233
  */
234
 
  DBUG_ASSERT(higher_bound > 0 && t >= range_boundaries[0]);
 
234
  assert(higher_bound > 0 && t >= range_boundaries[0]);
235
235
 
236
236
  /*
237
237
    Do binary search for minimal interval which contain t. We preserve:
382
382
sec_since_epoch(int year, int mon, int mday, int hour, int min ,int sec)
383
383
{
384
384
  /* Guard against my_time_t overflow(on system with 32 bit my_time_t) */
385
 
  DBUG_ASSERT(!(year == TIMESTAMP_MAX_YEAR && mon == 1 && mday > 17));
 
385
  assert(!(year == TIMESTAMP_MAX_YEAR && mon == 1 && mday > 17));
386
386
#ifndef WE_WANT_TO_HANDLE_UNORMALIZED_DATES
387
387
  /*
388
388
    It turns out that only whenever month is normalized or unnormalized
389
389
    plays role.
390
390
  */
391
 
  DBUG_ASSERT(mon > 0 && mon < 13);
 
391
  assert(mon > 0 && mon < 13);
392
392
  long days= year * DAYS_PER_NYEAR - EPOCH_YEAR * DAYS_PER_NYEAR +
393
393
             LEAPS_THRU_END_OF(year - 1) -
394
394
             LEAPS_THRU_END_OF(EPOCH_YEAR - 1);
489
489
  uint i;
490
490
  int shift= 0;
491
491
 
492
 
  DBUG_ENTER("TIME_to_gmt_sec");
493
 
 
494
492
  if (!validate_timestamp_range(t))
495
 
    DBUG_RETURN(0);
 
493
    return(0);
496
494
 
497
495
 
498
496
  /* We need this for correct leap seconds handling */
529
527
                           saved_seconds ? 0 : t->second);
530
528
 
531
529
  /* We have at least one range */
532
 
  DBUG_ASSERT(sp->revcnt >= 1);
 
530
  assert(sp->revcnt >= 1);
533
531
 
534
532
  if (local_t < sp->revts[0] || local_t > sp->revts[sp->revcnt])
535
533
  {
537
535
      This means that source time can't be represented as my_time_t due to
538
536
      limited my_time_t range.
539
537
    */
540
 
    DBUG_RETURN(0);
 
538
    return(0);
541
539
  }
542
540
 
543
541
  /* binary search for our range */
553
551
    if (local_t > (my_time_t) (TIMESTAMP_MAX_VALUE - shift * SECS_PER_DAY +
554
552
                               sp->revtis[i].rt_offset - saved_seconds))
555
553
    {
556
 
      DBUG_RETURN(0);                           /* my_time_t overflow */
 
554
      return(0);                           /* my_time_t overflow */
557
555
    }
558
556
    local_t+= shift * SECS_PER_DAY;
559
557
  }
576
574
  if (local_t < TIMESTAMP_MIN_VALUE)
577
575
    local_t= 0;
578
576
 
579
 
  DBUG_RETURN(local_t);
 
577
  return(local_t);
580
578
}
581
579
 
582
580
 
731
729
                               bool *in_dst_time_gap __attribute__((__unused__))) const
732
730
{
733
731
  /* Should be never called */
734
 
  DBUG_ASSERT(0);
 
732
  assert(0);
735
733
  return 0;
736
734
}
737
735
 
777
775
Time_zone_utc::get_name() const
778
776
{
779
777
  /* Should be never called */
780
 
  DBUG_ASSERT(0);
 
778
  assert(0);
781
779
  return 0;
782
780
}
783
781