xref: /reactos/sdk/include/ucrt/sys/utime.h (revision 53d808d2)
1 //
2 // sys/utime.h
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The _utime() family of functions.
7 //
8 #pragma once
9 
10 #include <corecrt.h>
11 
12 #pragma warning(push)
13 #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
14 _UCRT_DISABLE_CLANG_WARNINGS
15 
16 _CRT_BEGIN_C_HEADER
17 
18 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19 //
20 // Types
21 //
22 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23 #ifndef _CRT_NO_TIME_T
24     struct _utimbuf
25     {
26         time_t actime;          // access time
27         time_t modtime;         // modification time
28     };
29 #endif
30 
31 struct __utimbuf32
32 {
33     __time32_t actime;      // access time
34     __time32_t modtime;     // modification time
35 };
36 
37 struct __utimbuf64
38 {
39     __time64_t actime;      // access time
40     __time64_t modtime;     // modification time
41 };
42 
43 #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES && !defined _CRT_NO_TIME_T
44 
45     struct utimbuf
46     {
47         time_t actime;      // access time
48         time_t modtime;     // modification time
49     };
50 
51     struct utimbuf32
52     {
53         __time32_t actime;  // access time
54         __time32_t modtime; // modification time
55     };
56 
57 #endif
58 
59 
60 
61 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62 //
63 // Functions
64 //
65 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
66 _ACRTIMP int __cdecl _utime32(
67     _In_z_   char const*         _FileName,
68     _In_opt_ struct __utimbuf32* _Time
69     );
70 
71 _ACRTIMP int __cdecl _futime32(
72     _In_     int                 _FileHandle,
73     _In_opt_ struct __utimbuf32* _Time
74     );
75 
76 _ACRTIMP int __cdecl _wutime32(
77     _In_z_   wchar_t const*      _FileName,
78     _In_opt_ struct __utimbuf32* _Time
79     );
80 
81 _ACRTIMP int __cdecl _utime64(
82     _In_z_   char const*         _FileName,
83     _In_opt_ struct __utimbuf64* _Time
84     );
85 
86 _ACRTIMP int __cdecl _futime64(
87     _In_     int                 _FileHandle,
88     _In_opt_ struct __utimbuf64* _Time
89     );
90 
91 _ACRTIMP int __cdecl _wutime64(
92     _In_z_   wchar_t const*      _FileName,
93     _In_opt_ struct __utimbuf64* _Time
94     );
95 
96 
97 
98 #if !defined RC_INVOKED && !defined __midl && !defined _CRT_NO_TIME_T
99     #ifdef _USE_32BIT_TIME_T
100 
101         static __inline int __CRTDECL _utime(char const* const _FileName, struct _utimbuf* const _Time)
102         {
103             _STATIC_ASSERT(sizeof(struct _utimbuf) == sizeof(struct __utimbuf32));
104             return _utime32(_FileName, (struct __utimbuf32*)_Time);
105         }
106 
107         static __inline int __CRTDECL _futime(int const _FileHandle, struct _utimbuf* const _Time)
108         {
109             _STATIC_ASSERT(sizeof(struct _utimbuf) == sizeof(struct __utimbuf32));
110             return _futime32(_FileHandle, (struct __utimbuf32*)_Time);
111         }
112 
113         static __inline int __CRTDECL _wutime(wchar_t const* const _FileName, struct _utimbuf* const _Time)
114         {
115             _STATIC_ASSERT(sizeof(struct _utimbuf) == sizeof(struct __utimbuf32));
116             return _wutime32(_FileName, (struct __utimbuf32*)_Time);
117         }
118 
119     #else
120         static __inline int __CRTDECL _utime(char const* const _FileName, struct _utimbuf* const _Time)
121         {
122             _STATIC_ASSERT(sizeof(struct _utimbuf) == sizeof(struct __utimbuf64));
123             return _utime64(_FileName, (struct __utimbuf64*)_Time);
124         }
125 
126         static __inline int __CRTDECL _futime(int const _FileHandle, struct _utimbuf* const _Time)
127         {
128             _STATIC_ASSERT(sizeof(struct _utimbuf) == sizeof(struct __utimbuf64));
129             return _futime64(_FileHandle, (struct __utimbuf64*)_Time);
130         }
131 
132         static __inline int __CRTDECL _wutime(wchar_t const* const _FileName, struct _utimbuf* const _Time)
133         {
134             _STATIC_ASSERT(sizeof(struct _utimbuf) == sizeof(struct __utimbuf64));
135             return _wutime64(_FileName, (struct __utimbuf64*)_Time);
136         }
137 
138     #endif
139 
140     #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
141         #ifdef _USE_32BIT_TIME_T
142 
143             static __inline int __CRTDECL utime(char const* const _FileName, struct utimbuf* const _Time)
144             {
145                 _STATIC_ASSERT(sizeof(struct utimbuf) == sizeof(struct __utimbuf32));
146                 return _utime32(_FileName, (struct __utimbuf32*)_Time);
147             }
148 
149         #else
150 
151             static __inline int __CRTDECL utime(char const* const _FileName, struct utimbuf* const _Time)
152             {
153                 _STATIC_ASSERT(sizeof(struct utimbuf) == sizeof(struct __utimbuf64));
154                 return _utime64(_FileName, (struct __utimbuf64*)_Time);
155             }
156 
157         #endif
158     #endif
159 #endif
160 
161 _CRT_END_C_HEADER
162 _UCRT_RESTORE_CLANG_WARNINGS
163 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
164