Susumu Yata
null+****@clear*****
Tue Jul 12 12:15:39 JST 2016
Susumu Yata 2016-07-12 12:15:39 +0900 (Tue, 12 Jul 2016) New Revision: d9a0ecb3fc924f21aa8a36aac682161a167c3e9f https://github.com/groonga/groonga/commit/d9a0ecb3fc924f21aa8a36aac682161a167c3e9f Message: Round a value in typecast from Float to Time. GitHub: fix #581 Modified files: lib/db.c Modified: lib/db.c (+4 -2) =================================================================== --- lib/db.c 2016-07-12 12:14:44 +0900 (df5a5a6) +++ lib/db.c 2016-07-12 12:15:39 +0900 (85b1842) @@ -6188,8 +6188,10 @@ grn_obj_cast_bool(grn_ctx *ctx, grn_obj *src, grn_obj *dest, GRN_TIME_SET(ctx, dest, (long long int)(value) * GRN_TIME_USEC_PER_SEC); #define TIME2TIME(ctx, dest, value)\ GRN_TIME_SET(ctx, dest, value); -#define FLOAT2TIME(ctx, dest, value)\ - GRN_TIME_SET(ctx, dest, (long long int)(value * GRN_TIME_USEC_PER_SEC)); +#define FLOAT2TIME(ctx, dest, value) do {\ + double usec = round(value * GRN_TIME_USEC_PER_SEC);\ + GRN_TIME_SET(ctx, dest, usec);\ +} while (0) #define NUM2FLOAT(ctx, dest, value)\ GRN_FLOAT_SET(ctx, dest, value); -------------- next part -------------- HTML����������������������������... Download