STASIS
A pipeline delivery generator
Toggle main menu visibility
Loading...
Searching...
No Matches
src
lib
core
include
timespec.h
1
/* Functions for working with timespec structures
2
* Written by Daniel Collins (2017-2021)
3
* timespec_mod by Alex Forencich (2019)
4
* Various contributions by Ingo Albrecht (2021)
5
*
6
* This is free and unencumbered software released into the public domain.
7
*
8
* Anyone is free to copy, modify, publish, use, compile, sell, or
9
* distribute this software, either in source code form or as a compiled
10
* binary, for any purpose, commercial or non-commercial, and by any
11
* means.
12
*
13
* In jurisdictions that recognize copyright laws, the author or authors
14
* of this software dedicate any and all copyright interest in the
15
* software to the public domain. We make this dedication for the benefit
16
* of the public at large and to the detriment of our heirs and
17
* successors. We intend this dedication to be an overt act of
18
* relinquishment in perpetuity of all present and future rights to this
19
* software under copyright law.
20
*
21
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27
* OTHER DEALINGS IN THE SOFTWARE.
28
*
29
* For more information, please refer to <http://unlicense.org/>
30
*/
31
32
#ifndef DAN_TIMESPEC_H
33
#define DAN_TIMESPEC_H
34
35
#include <stdbool.h>
36
#include <sys/time.h>
37
#include <time.h>
38
39
#ifdef __cplusplus
40
extern
"C"
{
41
#endif
42
43
struct
timespec timespec_add(struct timespec ts1, struct timespec ts2);
44
struct
timespec timespec_sub(struct timespec ts1, struct timespec ts2);
45
struct
timespec timespec_mod(struct timespec ts1, struct timespec ts2);
46
47
struct
timespec timespec_min(struct timespec ts1, struct timespec ts2);
48
struct
timespec timespec_max(struct timespec ts1, struct timespec ts2);
49
struct
timespec timespec_clamp(struct timespec ts1, struct timespec min, struct timespec max);
50
51
int
timespec_cmp(
struct
timespec ts1,
struct
timespec ts2);
52
bool
timespec_eq(
struct
timespec ts1,
struct
timespec ts2);
53
bool
timespec_gt(
struct
timespec ts1,
struct
timespec ts2);
54
bool
timespec_ge(
struct
timespec ts1,
struct
timespec ts2);
55
bool
timespec_lt(
struct
timespec ts1,
struct
timespec ts2);
56
bool
timespec_le(
struct
timespec ts1,
struct
timespec ts2);
57
58
struct
timespec timespec_from_double(double s);
59
double
timespec_to_double(
struct
timespec ts);
60
struct
timespec timespec_from_timeval(struct timeval tv);
61
struct
timeval timespec_to_timeval(struct timespec ts);
62
struct
timespec timespec_from_ms(long milliseconds);
63
long
timespec_to_ms(
struct
timespec ts);
64
65
struct
timespec timespec_normalise(struct timespec ts);
66
67
#ifdef __cplusplus
68
}
69
#endif
70
71
#endif
/* !DAN_TIMESPEC_H */
Generated by
1.17.0