summaryrefslogtreecommitdiff
path: root/utility/rtos_compatibility_layers/posix/time.h
blob: 9fabdec579d9a471888f132f088148747226bb4f (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/***************************************************************************
 * Copyright (c) 2024 Microsoft Corporation
 * Copyright (c) 2026-present Eclipse ThreadX contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/

/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/**   ThreadX Component                                                   */
/**                                                                       */
/**   POSIX Compliancy Wrapper (POSIX)                                    */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/

/**************************************************************************/
/*                                                                        */
/*  EKP DEFINITIONS                                        RELEASE        */
/*                                                                        */
/*    tx_px_time.h                                        PORTABLE C      */
/*                                                           6.1.7        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    William E. Lamie, Microsoft Corporation                             */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This file defines the constants, structures, etc. needed to         */
/*    implement time related functionality for the Evacuation Kit         */
/*    for POSIX Users (POSIX)                                             */
/*                                                                        */
/**************************************************************************/

#ifndef _TX_PX_TIME_H
#define _TX_PX_TIME_H

#ifndef _TIME_T
#define _TIME_T
typedef  ULONG  time_t;
#endif

typedef INT clockid_t;

struct timespec
{
    time_t    tv_sec;                /* time in terms of seconds */
    ULONG     tv_nsec;               /* remaining time in terms of nano seconds*/
} ;

struct itimerspec
{
    struct timespec  it_interval ;         /* Timer period. */
    struct timespec  it_value;             /* Timer expiration. */
};

#define CLOCK_REALTIME  1
#define TIMER_ABSTIME   1
#define CLOCK_MONOTONIC 2

INT clock_settime(clockid_t, const struct timespec *);
INT clock_gettime(clockid_t, struct timespec *);
INT clock_getres(clockid_t, struct timespec *);


INT nanosleep(struct timespec *req, struct timespec *rem);
UINT sleep(ULONG seconds);

#endif