Skip to content

Commit

Permalink
[CBRD-25236] Output error related to TZM in timezone information (#5002)
Browse files Browse the repository at this point in the history
http://jira.cubrid.org/browse/CBRD-25236

* When obtaining TZM information from the to_char() and time_format() functions, it appears differently from the date_format() function.
  • Loading branch information
ctshim authored and mhoh3963 committed Aug 6, 2024
1 parent 35a98c2 commit 3286253
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/query/string_opfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12492,9 +12492,9 @@ db_time_format (const DB_VALUE * src_value, const DB_VALUE * format, const DB_VA
strcat (res, tzd);
break;
case 'H':
if (tzh >= 0)
if ((tzh >= 0) && (tzm >= 0))
{
sprintf (hours_or_minutes, "%02d", tzh);
sprintf (hours_or_minutes, "%c%02d", '+', tzh);
}
else
{
Expand All @@ -12503,14 +12503,7 @@ db_time_format (const DB_VALUE * src_value, const DB_VALUE * format, const DB_VA
strcat (res, hours_or_minutes);
break;
case 'M':
if (tzm >= 0)
{
sprintf (hours_or_minutes, "%02d", tzm);
}
else
{
sprintf (hours_or_minutes, "%c%02d", '-', -tzm);
}
sprintf (hours_or_minutes, "%02d", (tzm >= 0) ? tzm : -tzm);
strcat (res, hours_or_minutes);
break;
}
Expand Down Expand Up @@ -17847,18 +17840,13 @@ date_to_char (const DB_VALUE * src_value, const DB_VALUE * format_str, const DB_
}
else
{
tzh = -tzh;
sprintf (&result_buf[i], "%c%02d\n", '-', tzh);
sprintf (&result_buf[i], "%c%02d\n", '-', -tzh);
}
i += 3;
break;

case DT_TZM:
if (tzm < 0)
{
tzm = -tzm;
}
sprintf (&result_buf[i], "%02d\n", tzm);
sprintf (&result_buf[i], "%02d\n", ((tzm < 0) ? -tzm : tzm));
result_size--;
i += 2;
break;
Expand Down

0 comments on commit 3286253

Please sign in to comment.