Skip to content

Commit f85b11d

Browse files
authored
Merge pull request #5661 from tautschnig/library-time-windows
C library: Windows defines time to _time64 (or _time32)
2 parents 1b29b67 + 2cbac99 commit f85b11d

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)