8000 changed time format to no longer lose microseconds by btoneill · Pull Request #3065 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

changed time format to no longer lose microseconds #3065

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

Merged
merged 3 commits into from
Feb 20, 2019

Conversation

btoneill
Copy link
@btoneill btoneill commented Feb 8, 2019

ChangeLog: rrdcached plugin: Time resolution has been improved to microseconds.

Have been sending an int to rrdcached for the epoch value, it supports microseconds. You want to use microseconds.

See https://lists.oetiker.ch/pipermail/rrd-developers/2003-March/001007.html for we want this

@octo octo added the Feature label Feb 10, 2019
Copy link
Member
@octo octo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @btoneill, thank you very much for your PR! Also thank you for providing that reference.

Support for higher resolution time stamps appears to be new in RRDtool 1.1, and we need to (continue to) support the previous versions. Can you please make this configurable, with the second-precision time format being the default?

Also, you're change log entry has it backwards: this adds support for microsecond resolution, it says "no longer use" which is incorrect.

Thanks and best regards,
—octo

@btoneill
Copy link
Author
btoneill commented Feb 10, 2019 via email

@octo
Copy link
Member
octo commented Feb 10, 2019

Hey, I didn't see that the email you referenced was from 2003. If this feature has been in RRDtool for ~16 years, then the option is not required. Since you didn't update the description yet, I'm going to go ahead and do that.

Thanks and best regards,
—octo

Copy link
Member
@octo octo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the inline comment is fixed this is good to go. Thanks @btoneill!

src/rrdcached.c Outdated
status = snprintf(buffer, buffer_len, "%lu", (unsigned long)t);
t = CDTIME_T_TO_DOUBLE(vl->time);

status = snprintf(buffer, buffer_len, "%f", t);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description and the referenced email both talk about microseconds specifically, but this format may in fact be more precise than that. Please print as %.6f instead.

@btoneill
Copy link
Author
btoneill commented Feb 10, 2019 via email

@octo
Copy link
Member
octo commented Feb 10, 2019

the sub-second part is
something very close to nanoseconds

One microsecond is 1000 nanoseconds.

@btoneill
Copy link
Author

I think I have updated with the requested change.

Copy link
Member
@octo octo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @btoneill,

the continuous integration is unhappy because there's a type mismatch. I've left more information inline. Also, the %.6f format did not yet make it to the repo.

Best regards,
—octo

src/rrdcached.c Outdated
@@ -74,8 +74,9 @@ static int value_list_to_string(char *buffer, int buffer_len,

memset(buffer, '\0', buffer_len);

t = CDTIME_T_TO_TIME_T(vl->time);
status = snprintf(buffer, buffer_len, "%lu", (unsigned long)t);
t = CDTIME_T_TO_DOUBLE(vl->time);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t has the wrong type now (should be double, is time_t. I'd recommend to remove t completely and inline the conversion:

status = snprintf(buffer, buffer_len, "%.6f", CDTIME_T_TO_DOUBLE(vl->time));

@btoneill
Copy link
Author
btoneill commented Feb 11, 2019 via email

octo
octo previously approved these changes Feb 19, 2019
@octo
Copy link
Member
octo commented Feb 19, 2019

Thanks again for your PR @btoneill!

@octo octo added the Automerge Labels PRs to be merged by a bot once approved label Feb 19, 2019
@octo
Copy link
Member
octo commented Feb 20, 2019

Rebased on master

@collectd-bot collectd-bot merged commit 277bcb9 into collectd:master Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automerge Labels PRs to be merged by a bot once approved Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0