Lely core libraries  2.2.5
time.h File Reference
#include <lely/libc/time.h>
#include <stdint.h>
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void timespec_add (struct timespec *tp, const struct timespec *inc)
 Adds the time interval *inc to the time at tp.
 
void timespec_add_sec (struct timespec *tp, uint_least64_t sec)
 Adds sec seconds to the time at tp.
 
void timespec_add_msec (struct timespec *tp, uint_least64_t msec)
 Adds msec milliseconds to the time at tp.
 
void timespec_add_usec (struct timespec *tp, uint_least64_t usec)
 Adds usec microseconds to the time at tp.
 
void timespec_add_nsec (struct timespec *tp, uint_least64_t nsec)
 Adds nsec nanoseconds to the time at tp.
 
void timespec_sub (struct timespec *tp, const struct timespec *dec)
 Subtracts the time interval *dec from the time at tp.
 
void timespec_sub_sec (struct timespec *tp, uint_least64_t sec)
 Subtracts sec seconds from the time at tp.
 
void timespec_sub_msec (struct timespec *tp, uint_least64_t msec)
 Subtracts msec milliseconds from the time at tp.
 
void timespec_sub_usec (struct timespec *tp, uint_least64_t usec)
 Subtracts usec microseconds from the time at tp.
 
void timespec_sub_nsec (struct timespec *tp, uint_least64_t nsec)
 Subtracts nsec nanoseconds from the time at tp.
 
int_least64_t timespec_diff_sec (const struct timespec *t1, const struct timespec *t2)
 Returns the time difference (in seconds) between *t1 and *t2. More...
 
int_least64_t timespec_diff_msec (const struct timespec *t1, const struct timespec *t2)
 Returns the time difference (in milliseconds) between *t1 and *t2. More...
 
int_least64_t timespec_diff_usec (const struct timespec *t1, const struct timespec *t2)
 Returns the time difference (in microseconds) between *t1 and *t2. More...
 
int_least64_t timespec_diff_nsec (const struct timespec *t1, const struct timespec *t2)
 Returns the time difference (in nanoseconds) between *t1 and *t2.
 
int timespec_cmp (const void *p1, const void *p2)
 Compares two times. More...
 

Detailed Description

This header file is part of the utilities library; it contains the time function declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file time.h.

Function Documentation

◆ timespec_diff_sec()

int_least64_t timespec_diff_sec ( const struct timespec *  t1,
const struct timespec *  t2 
)
inline

Returns the time difference (in seconds) between *t1 and *t2.

Difference is rounded to full seconds towards zero (with decimals truncated).

Definition at line 201 of file time.h.

◆ timespec_diff_msec()

int_least64_t timespec_diff_msec ( const struct timespec *  t1,
const struct timespec *  t2 
)
inline

Returns the time difference (in milliseconds) between *t1 and *t2.

Difference is rounded to full miliseconds towards zero (with decimals truncated).

Definition at line 207 of file time.h.

◆ timespec_diff_usec()

int_least64_t timespec_diff_usec ( const struct timespec *  t1,
const struct timespec *  t2 
)
inline

Returns the time difference (in microseconds) between *t1 and *t2.

Difference is rounded to full microseconds towards zero (with decimals truncated).

Definition at line 214 of file time.h.

◆ timespec_cmp()

int timespec_cmp ( const void *  p1,
const void *  p2 
)
inline

Compares two times.

Returns
an integer greater than, equal to, or less than 0 if the time stored at p1 is greater than, equal to, or less than the time stored at p2.

Definition at line 228 of file time.h.