CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
sys
time.h
Go to the documentation of this file.
1
// Copyright SCI Semiconductor and CHERIoT Contributors.
2
// SPDX-License-Identifier: MIT
3
#pragma once
4
/**
5
* \file
6
* POSIX time definitions. This is *not* a complete implementation of the POSIX
7
* spec. The following are not implemented in CHERIoT RTOS:
8
*
9
* - `FD_CLR()`, `FD_ISSET()`, `FD_SET(), `FD_ZERO()`, `FD_SETSIZE`, and
10
* `fd_set`, used for `select`.
11
* - `select` is not implemented because we do not have the POSIX file
12
* descriptor abstraction, use the APIs in `multiwaiter.h` to wait for multiple
13
* event sources.
14
* - `utimes`, which depends on a filesystem.
15
* - `getitimer` and `setitimer`, which are deprecated in POSIX.
16
*/
17
18
#include <cdefs.h>
19
#include <stdint.h>
20
21
// The names in this file come from C or POSIX and so do not correspond to our
22
// naming scheme. This header is expected to be included in C, so should also
23
// not provide warnings about void in function parameter lists.
24
// NOLINTBEGIN(readability-identifier-naming,modernize-redundant-void-arg)
25
26
/// Type for holding seconds
27
typedef
int64_t time_t;
28
/// Type for holding microseconds up to one second, which requires 20 bits.
29
typedef
uint32_t suseconds_t;
30
31
/**
32
* Type used for time values as seconds and microseconds.
33
*/
34
struct
timeval
35
{
36
/// Number of seconds.
37
time_t
tv_sec
;
38
/// Number of microseconds (must be less than 1,000,000)
39
suseconds_t
tv_usec
;
40
};
41
42
/**
43
* Get the current wall-clock time. The time-zone parameter is unused.
44
*/
45
__cheriot_libcall
int
gettimeofday
(
struct
timeval
*__restrict tp,
46
void
*__restrict tzp);
47
48
// NOLINTEND(readability-identifier-naming,modernize-redundant-void-arg)
timeval
Definition
time.h:35
timeval::tv_usec
suseconds_t tv_usec
Number of microseconds (must be less than 1,000,000).
Definition
time.h:39
timeval::tv_sec
time_t tv_sec
Number of seconds.
Definition
time.h:37
gettimeofday
__cheriot_libcall int gettimeofday(struct timeval *__restrict tp, void *__restrict tzp)
Get the current wall-clock time.
Generated by
1.18.0