Skip to content

Commit 612205d

Browse files
author
Daniel Shelepanov
committed
[PBCKP-216] imposing POSIX locale
...in order to impose dot-based floating point representation
1 parent 8bb0a61 commit 612205d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/show.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,9 +1045,15 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
10451045
appendPQExpBuffer(buf, "%lu", tlinfo->size);
10461046

10471047
json_add_key(buf, "zratio", json_level);
1048+
1049+
// forcing comma-based floating point representation
1050+
char *save_locale = setlocale(LC_NUMERIC, NULL);
1051+
setlocale(LC_NUMERIC, "POSIX");
10481052
if (tlinfo->size != 0)
10491053
zratio = ((float)xlog_seg_size*tlinfo->n_xlog_files) / tlinfo->size;
10501054
appendPQExpBuffer(buf, "%.2f", zratio);
1055+
// restoring previous locale
1056+
setlocale(LC_NUMERIC, save_locale);
10511057

10521058
if (tlinfo->closest_backup != NULL)
10531059
snprintf(tmp_buf, lengthof(tmp_buf), "%s",

0 commit comments

Comments
 (0)