Navigation Menu

Skip to content

Commit

Permalink
Remove needless overflow check
Browse files Browse the repository at this point in the history
It is needed in GRN_TIME -> struct tm not struct tm -> GRN_TIME.
  • Loading branch information
kou committed Oct 24, 2012
1 parent 368a97e commit 044e97a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions ha_mroonga.cpp
Expand Up @@ -1507,13 +1507,9 @@ static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf,
static long long int mrn_tm_to_grn_time(struct tm *time, int usec)
{
MRN_DBUG_ENTER_FUNCTION();
bool after_epoch_time =
(time->tm_year >= (UNIX_EPOCH_TIME_YEAR - TM_YEAR_BASE));
long long int grn_time;
long long int sec = mktime(time);
bool failed = (sec == -1);
bool overflowed = (after_epoch_time && sec < 0);
if (failed || overflowed) {
if (sec == -1) {
grn_time = 0;
} else {
grn_time = GRN_TIME_PACK(sec + mrn_utc_diff_in_seconds, usec);
Expand Down

0 comments on commit 044e97a

Please sign in to comment.