Skip to content

Update comment for converting seconds to milliseconds #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ngx_http_statsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ ngx_http_statsd_metric_value(ngx_str_t *value)
return (ngx_uint_t) -1;
};

/* Hack to convert milliseconds to a number. */
/*
* Hack to convert a float into an integer.
*
* For values like $response_time, nginx reports them as a
* float in seconds with millisecond precision. e.g. 1.519,
* but statsd requires an integer to be sent.
*/
if (value->len > 4 && value->data[value->len - 4] == '.') {
n = ngx_atoi(value->data, value->len - 4);
m = ngx_atoi(value->data + (value->len - 3), 3);
Expand Down