Skip to content

Commit b09213d

Browse files
authored
Merge pull request #261 from viest/dev
Fix: musl libc
2 parents 5252ffe + 34f5375 commit b09213d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
*.lo
33
*.la
44
.libs
5+
.dockerignore
6+
Dockerfile
57
debug
68
debug.php
79
php

kernel/read.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "xlswriter.h"
1414
#include "ext/date/php_date.h"
15+
#include "ext/standard/php_math.h"
1516

1617
/* {{{ */
1718
xlsxioreader file_open(const char *directory, const char *file_name) {
@@ -106,7 +107,7 @@ void data_to_custom_type(const char *string_value, const size_t string_value_len
106107
return;
107108
}
108109

109-
double value = strtod(string_value, NULL);
110+
double value = zend_strtod(string_value, NULL);
110111
double days, partDay, hours, minutes, seconds;
111112

112113
days = floor(value);
@@ -115,7 +116,7 @@ void data_to_custom_type(const char *string_value, const size_t string_value_len
115116
partDay = partDay * 24 - hours;
116117
minutes = floor(partDay * 60);
117118
partDay = partDay * 60 - minutes;
118-
seconds = round(partDay * 60);
119+
seconds = _php_math_round(partDay * 60, 0, PHP_ROUND_HALF_UP);
119120

120121
zval datetime;
121122
php_date_instantiate(php_date_get_date_ce(), &datetime);

0 commit comments

Comments
 (0)