62982fc6902413ef78a88f0b8f7289e3166b541b
2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2013 JP Ikaheimonen <jp_ikaheimonen@mentor.com>
5 * Copyright (C) 2016 Michael Jeanson <mjeanson@efficios.com>
8 #ifndef BABELTRACE_COMPAT_TIME_H
9 #define BABELTRACE_COMPAT_TIME_H
19 * The Windows version of the time functions use one common tm structure per
20 * thread which makes them thread-safe. Implement the POSIX _r variants by
21 * copying this to a user supplied struct.
25 struct tm
*bt_gmtime_r(const time_t *timep
, struct tm
*result
)
33 local_res
= gmtime(timep
);
39 memcpy(result
, local_res
, sizeof(struct tm
));
46 struct tm
*bt_localtime_r(const time_t *timep
, struct tm
*result
)
54 local_res
= localtime(timep
);
60 memcpy(result
, local_res
, sizeof(struct tm
));
66 #else /* __MINGW32__ */
69 struct tm
*bt_gmtime_r(const time_t *timep
, struct tm
*result
)
71 return gmtime_r(timep
, result
);
75 struct tm
*bt_localtime_r(const time_t *timep
, struct tm
*result
)
77 return localtime_r(timep
, result
);
80 #endif /* __MINGW32__ */
82 #endif /* BABELTRACE_COMPAT_TIME_H */
This page took 0.032087 seconds and 5 git commands to generate.