@@ -421,29 +421,27 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
421
421
422
422
if (seconds == 0 ) {
423
423
val = Qnil ;
424
- } else {
425
- if (seconds < MYSQL2_MIN_TIME || seconds > MYSQL2_MAX_TIME ) { // use DateTime instead
426
- VALUE offset = INT2NUM (0 );
427
- if (args -> db_timezone == intern_local ) {
424
+ } else if (seconds < MYSQL2_MIN_TIME || seconds > MYSQL2_MAX_TIME ) { // use DateTime instead
425
+ VALUE offset = INT2NUM (0 );
426
+ if (args -> db_timezone == intern_local ) {
427
+ offset = rb_funcall (cMysql2Client , intern_local_offset , 0 );
428
+ }
429
+ val = rb_funcall (cDateTime , intern_civil , 7 , UINT2NUM (ts -> year ), UINT2NUM (ts -> month ), UINT2NUM (ts -> day ), UINT2NUM (ts -> hour ), UINT2NUM (ts -> minute ), UINT2NUM (ts -> second ), offset );
430
+ if (!NIL_P (args -> app_timezone )) {
431
+ if (args -> app_timezone == intern_local ) {
428
432
offset = rb_funcall (cMysql2Client , intern_local_offset , 0 );
433
+ val = rb_funcall (val , intern_new_offset , 1 , offset );
434
+ } else { // utc
435
+ val = rb_funcall (val , intern_new_offset , 1 , opt_utc_offset );
429
436
}
430
- val = rb_funcall (cDateTime , intern_civil , 7 , UINT2NUM (ts -> year ), UINT2NUM (ts -> month ), UINT2NUM (ts -> day ), UINT2NUM (ts -> hour ), UINT2NUM (ts -> minute ), UINT2NUM (ts -> second ), offset );
431
- if (!NIL_P (args -> app_timezone )) {
432
- if (args -> app_timezone == intern_local ) {
433
- offset = rb_funcall (cMysql2Client , intern_local_offset , 0 );
434
- val = rb_funcall (val , intern_new_offset , 1 , offset );
435
- } else { // utc
436
- val = rb_funcall (val , intern_new_offset , 1 , opt_utc_offset );
437
- }
438
- }
439
- } else {
440
- val = rb_funcall (rb_cTime , args -> db_timezone , 7 , UINT2NUM (ts -> year ), UINT2NUM (ts -> month ), UINT2NUM (ts -> day ), UINT2NUM (ts -> hour ), UINT2NUM (ts -> minute ), UINT2NUM (ts -> second ), ULONG2NUM (ts -> second_part ));
441
- if (!NIL_P (args -> app_timezone )) {
442
- if (args -> app_timezone == intern_local ) {
443
- val = rb_funcall (val , intern_localtime , 0 );
444
- } else { // utc
445
- val = rb_funcall (val , intern_utc , 0 );
446
- }
437
+ }
438
+ } else {
439
+ val = rb_funcall (rb_cTime , args -> db_timezone , 7 , UINT2NUM (ts -> year ), UINT2NUM (ts -> month ), UINT2NUM (ts -> day ), UINT2NUM (ts -> hour ), UINT2NUM (ts -> minute ), UINT2NUM (ts -> second ), ULONG2NUM (ts -> second_part ));
440
+ if (!NIL_P (args -> app_timezone )) {
441
+ if (args -> app_timezone == intern_local ) {
442
+ val = rb_funcall (val , intern_localtime , 0 );
443
+ } else { // utc
444
+ val = rb_funcall (val , intern_utc , 0 );
447
445
}
448
446
}
449
447
}
0 commit comments