https://github.com/cilium/cilium
Raw File
Tip revision: 952d9d33740fc77e1a94d5a52b38d2a313e5c570 authored by André Martins on 19 May 2021, 16:42:32 UTC
Prepare for release v1.10.0
Tip revision: 952d9d3
mono.h
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2020 Authors of Cilium */

#ifndef __LIB_MONO_H_
#define __LIB_MONO_H_

/* Moved out from time.h to avoid circular header dependency. */
#if defined(BPF_HAVE_JIFFIES) && defined(ENABLE_JIFFIES) && KERNEL_HZ != 1
# define BPF_MONO_SCALER	8
# define bpf_mono_now()		(jiffies >> BPF_MONO_SCALER)
# define bpf_sec_to_mono(s)	(bpf_sec_to_jiffies(s) >> BPF_MONO_SCALER)
#else
# define bpf_mono_now()		bpf_ktime_get_sec()
# define bpf_sec_to_mono(s)	(s)
#endif /* BPF_HAVE_JIFFIES && ENABLE_JIFFIES */

#endif /* __LIB_MONO_H_ */
back to top