Navigation Menu

Skip to content

Commit

Permalink
Use 1970-01-01 00:00:00 for time that can't be handled by mktime()
Browse files Browse the repository at this point in the history
refs #1476
  • Loading branch information
kou committed Oct 24, 2012
1 parent 85ca0c6 commit 8a10500
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ha_mroonga.cpp
Expand Up @@ -1505,8 +1505,13 @@ 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();
long long int sec = mktime(time) + mrn_utc_diff_in_seconds;
long long int grn_time = GRN_TIME_PACK(sec, usec);
long long int grn_time;
long long int sec = mktime(time);
if (sec == -1) {
grn_time = 0;
} else {
grn_time = GRN_TIME_PACK(sec + mrn_utc_diff_in_seconds, usec);
}
DBUG_RETURN(grn_time);
}

Expand Down

0 comments on commit 8a10500

Please sign in to comment.