Skip to content

Commit 2cbac99

Browse files
committed
C library: Windows defines time to _time64 (or _time32)
Windows uses time as a wrapper to _time64 by default, or _time32 when _USE_32BIT_TIME_T is defined. See https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64?view=msvc-160. This is a fix-up to c6f1ed5, which introduced a broken regression test for Windows because of the then-undefined _time64 function.
1 parent 813a0ad commit 2cbac99

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/ansi-c/library/time.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,48 @@ time_t time(time_t *tloc)
1717
return res;
1818
}
1919

20+
/* FUNCTION: _time64 */
21+
22+
#ifdef _WIN32
23+
24+
# ifndef __CPROVER_TIME_H_INCLUDED
25+
# include <time.h>
26+
# define __CPROVER_TIME_H_INCLUDED
27+
# endif
28+
29+
time_t __VERIFIER_nondet_time_t();
30+
31+
time_t _time64(time_t *tloc)
32+
{
33+
time_t res = __VERIFIER_nondet_time_t();
34+
if(tloc)
35+
*tloc = res;
36+
return res;
37+
}
38+
39+
#endif
40+
41+
/* FUNCTION: _time32 */
42+
43+
#if defined(_WIN32) && defined(_USE_32BIT_TIME_T)
44+
45+
# ifndef __CPROVER_TIME_H_INCLUDED
46+
# include <time.h>
47+
# define __CPROVER_TIME_H_INCLUDED
48+
# endif
49+
50+
__time32_t __VERIFIER_nondet_time32_t();
51+
52+
__time32_t _time32(__time32_t *tloc)
53+
{
54+
__time32_t res = __VERIFIER_nondet_time32_t();
55+
if(tloc)
56+
*tloc = res;
57+
return res;
58+
}
59+
60+
#endif
61+
2062
/* FUNCTION: gmtime */
2163

2264
#ifndef __CPROVER_TIME_H_INCLUDED

0 commit comments

Comments
 (0)