Skip to content
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

Assign the same timestamp to measurements from a single transmission #426

Open
workoft opened this issue Apr 29, 2020 · 3 comments · May be fixed by #455
Open

Assign the same timestamp to measurements from a single transmission #426

workoft opened this issue Apr 29, 2020 · 3 comments · May be fixed by #455

Comments

@workoft
Copy link

workoft commented Apr 29, 2020

Meters with d0 interface will typically transmit several values within one burst. vzlogger does not group these bursts, but instead treats each line individually. This causes values from a single burst to have slightly different timestamps, which in turn is ugly if you are trying to do calculations with these measurements.
Is there a way to assign a single timestamp to all values of one burst, such as by re-using timestamps that aren't older than a specified time? Or by specifying the first channel that is transmitted as the timestamp channel and having all other channels just copy the last timestamp from that channel?

This is related to issue #417 - the user is asking to group measurements in the database (but also from different meters). I'm asking how to assign the same timestamp to measurements from one transmission burst.

@r00t-
Copy link
Contributor

r00t- commented Mar 10, 2021

[EDIT: i i analyzed SML instead if the requested D0 here - but both have the same bug ]

this issue should only occur when use_local_time is set,
your meter is not sending timestamps?

also, your interpretation does not seem quite true.
vzlogger reads a whole "burst" (file) from the meter, and then processes it:

/* parse SML file & stripping escape sequences */

but does attach a new microsecod-precision timestamp to each "line" (message) (when use_local_time is set):
gettimeofday(&tv, NULL); /* use local time */

actually the differences between those timestamps should be really, really tiny, as it's differences are only due to the execution time of the C code.

but the fix should be trivial, just generate a timestamp in after sml_file_parse() and then pass it into _parse() for all readings.
or just overwrite rds[m]->time() in the caller, to avoid changing _parse().

@r00t- r00t- linked a pull request Mar 11, 2021 that will close this issue
@r00t-
Copy link
Contributor

r00t- commented Mar 11, 2021

@workoft: can you test the fix in #455 ?

@r00t-
Copy link
Contributor

r00t- commented Apr 14, 2021

@workoft: ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants