File: interval.go

package info (click to toggle)
golang-collectd 0.5.0%2Bgit20240104.26404de-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: ansic: 324; sh: 7; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package fake

// #cgo CPPFLAGS: -DHAVE_CONFIG_H
// #cgo LDFLAGS: -ldl
// #include <stdlib.h>
// #include "plugin.h"
//
// static cdtime_t interval = TIME_T_TO_CDTIME_T_STATIC(10);
// cdtime_t plugin_get_interval(void) {
//   return interval;
// }
// void plugin_set_interval(cdtime_t d) {
//   interval = d;
// }
import "C"

import (
	"time"

	"collectd.org/cdtime"
)

// SetInterval sets the interval returned by the fake plugin_get_interval()
// function.
func SetInterval(d time.Duration) {
	ival := cdtime.NewDuration(d)
	C.plugin_set_interval(C.cdtime_t(ival))
}