1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 /**************************************************************************/
12 /**************************************************************************/
13 /**                                                                       */
14 /**   ThreadX Component                                                   */
15 /**                                                                       */
16 /**   POSIX Compliancy Wrapper (POSIX)                                    */
17 /**                                                                       */
18 /**************************************************************************/
19 /**************************************************************************/
20 
21 /**************************************************************************/
22 /*                                                                        */
23 /*  EKP DEFINITIONS                                        RELEASE        */
24 /*                                                                        */
25 /*    tx_px_time.h                                        PORTABLE C      */
26 /*                                                           6.1.7        */
27 /*  AUTHOR                                                                */
28 /*                                                                        */
29 /*    William E. Lamie, Microsoft Corporation                             */
30 /*                                                                        */
31 /*  DESCRIPTION                                                           */
32 /*                                                                        */
33 /*    This file defines the constants, structures, etc. needed to         */
34 /*    implement time related functionality for the Evacuation Kit         */
35 /*    for POSIX Users (POSIX)                                             */
36 /*                                                                        */
37 /*                                                                        */
38 /*  RELEASE HISTORY                                                       */
39 /*                                                                        */
40 /*    DATE              NAME                      DESCRIPTION             */
41 /*                                                                        */
42 /*  06-02-2021     William E. Lamie         Initial Version 6.1.7         */
43 /*                                                                        */
44 /**************************************************************************/
45 
46 #ifndef _TX_PX_TIME_H
47 #define _TX_PX_TIME_H
48 
49 #ifndef _TIME_T
50 #define _TIME_T
51 typedef  ULONG  time_t;
52 #endif
53 
54 typedef INT clockid_t;
55 
56 struct timespec
57 {
58     time_t    tv_sec;                /* time in terms of seconds */
59     ULONG     tv_nsec;               /* remaining time in terms of nano seconds*/
60 } ;
61 
62 struct itimerspec
63 {
64     struct timespec  it_interval ;         /* Timer period. */
65     struct timespec  it_value;             /* Timer expiration. */
66 };
67 
68 #define CLOCK_REALTIME  1
69 #define TIMER_ABSTIME   1
70 #define CLOCK_MONOTONIC 2
71 
72 INT clock_settime(clockid_t, const struct timespec *);
73 INT clock_gettime(clockid_t, struct timespec *);
74 INT clock_getres(clockid_t, struct timespec *);
75 
76 
77 INT nanosleep(struct timespec *req, struct timespec *rem);
78 UINT sleep(ULONG seconds);
79 
80 #endif
81 
82 
83