2017-03-05 10:06:32 -04:00
|
|
|
/** Timestamp hook.
|
|
|
|
*
|
|
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
|
|
|
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
|
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
/** @addtogroup hooks Hook functions
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hook.h"
|
|
|
|
#include "plugin.h"
|
|
|
|
#include "timing.h"
|
|
|
|
|
2017-03-27 12:26:11 +02:00
|
|
|
static int ts_read(struct hook *h, struct sample *smps[], size_t *cnt)
|
2017-03-05 10:06:32 -04:00
|
|
|
{
|
2017-03-27 12:26:11 +02:00
|
|
|
for (int i = 0; i < *cnt; i++)
|
|
|
|
smps[i]->ts.origin = smps[i]->ts.received;
|
2017-03-05 10:06:32 -04:00
|
|
|
|
2017-03-20 09:14:10 -03:00
|
|
|
return 0;
|
2017-03-05 10:06:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct plugin p = {
|
|
|
|
.name = "ts",
|
2017-03-27 12:26:11 +02:00
|
|
|
.description = "Overwrite origin timestamp of samples with receive timestamp",
|
2017-03-05 10:06:32 -04:00
|
|
|
.type = PLUGIN_TYPE_HOOK,
|
|
|
|
.hook = {
|
|
|
|
.priority = 99,
|
2017-03-27 12:26:11 +02:00
|
|
|
.read = ts_read,
|
|
|
|
.size = 0
|
2017-03-05 10:06:32 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
REGISTER_PLUGIN(&p)
|
|
|
|
|
|
|
|
/** @} */
|