1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/lib/hooks/ts.c

36 lines
765 B
C
Raw Normal View History

/** 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-27 12:26:11 +02:00
for (int i = 0; i < *cnt; i++)
smps[i]->ts.origin = smps[i]->ts.received;
return 0;
}
static struct plugin p = {
.name = "ts",
2017-03-27 12:26:11 +02:00
.description = "Overwrite origin timestamp of samples with receive timestamp",
.type = PLUGIN_TYPE_HOOK,
.hook = {
.priority = 99,
2017-03-27 12:26:11 +02:00
.read = ts_read,
.size = 0
}
};
REGISTER_PLUGIN(&p)
/** @} */